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

Ashutosh Munot1
Kilo Patron
Kilo Patron

Hi,


You have to set couple of properties in User preference table for this new user.

 

1) my_home_navigation_page

2) com.snc.pa.ui.preferences_dashboards

 

Second things belongs to the Dashboard of the user and First thing is that you will see dashboard and not home page.


I Second attribut you have to set value as : {"last":"sys_id of dashboard."}

First Attribute as : $pa_dashboard.do

 

Thanks,
Ashutosh

Hello,

Thanks for your reply!

Will this work for all the users?

Can we set a property in User preference 

Name: glide.home.page

Value :$pa_dashboard.do?sysparm_dashboard=6ebbaa24db1333005a44a0f2ca961967

 

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. 🙂

Community Alums
Not applicable

Thanks! a bunch.