Default Dashboard for First login users

msm4
Mega Guru

Hello Team,

I trying set a default dashboard for all the new users on their first login.

to achieve that i am writing a After insert BR on the user table(whenever a new user created), querying the user_preference table and setting the value field with the sys_id of the dashboard.

example:

var gr= new GlideRecord('sys_user_preference');

gr.addQuery('name','glide.home.page');

gr.query();

if(gr.hasNext()){

gr.value='$pa_dashboard.do?sysparm_dashboard=6ebbaa24db1333005a44a0f2ca961967';

gr.update();

}

seems to be not working, can anyone let me know where im going wrong.

1 ACCEPTED SOLUTION

msm4
Mega Guru

Found the solution. 

I have written a before Business Rule on the user table, whenever a new user record in the user table, a new entry need to be created in sys_user_preference table with name "com.snc.pa.ui.preferences_dashboards" , having a value of sys_ID of the dashboard. Find the below code I have written on user table.

(function executeRule(current, previous /*null when async*/) {

// Add your code here
var gr= new GlideRecord('sys_user_preference');
gr.initialize();
gr.name = 'com.snc.pa.ui.preferences_dashboards';
gr.value={"last":"89bdea10db9333005a44a0f2ca9619f3"};
gr.insert();

})(current, previous);

 

I hope this will help someone. 🙂

View solution in original post

5 REPLIES 5

sadly, this only applies to the old dashboard and no longer for the new platform analytics dashboard.
the user pref setting has an almost identical name, but many other settings inside the json..

they just scrambled the name 😉
com.snc.par.dashboards.ui.preferences
> and its now an array of objects inside the content.. starting with "recent:"

so setting a default dashboard for people is getting more and more ridiculous