- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2019 12:32 AM
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.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2019 03:57 AM
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. 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2019 04:31 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2019 04:48 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2019 03:57 AM
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. 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-09-2021 10:11 AM
Thanks! a bunch.
