Menu

Setting a Dashboard as a Default Homepage

Follow the below steps to Setting a Dashboard as a Default Homepage:

  • Create a business rule. Navigate to System DefinitionBusiness Rules.
  • Click New.
  1. Table: User Role [sys_user_has_role]
  2. Advance: True
  3. When: Before
  4. Query: True
  5. Script:
var iRole = new GlideRecord('sys_user_has_role');
iRole.addQuery('role', 'e1a3c4f8df93210068c37a0d3df26321'); // Role sys id
iRole.query();
while(iRole.next()) {
	var page = new GlideRecord('sys_user_preference');
	page.addQuery('name', 'com.snc.pa.ui.preferences_dashboards');
	page.addQuery('user', iRole.user);
	page.query();
	if(page.next()) {
		page.value = '{"last":"a64b7031d7201100b96d45a3ce610335"}'; //Dashboard sysID
		page.description = 'Set by a fix script';
		page.update();
	}
	else {
		page.description = 'Set by a fix script';
		page.name = 'com.snc.pa.ui.preferences_dashboards'; 
		page.type = 'string';
		page.value = '{"last":"a64b7031d7201100b96d45a3ce610335"}'; //Dashboard sysID
		page.user = iRole.user;
		page.insert();
	}
	
}

 

Facebook Comments