is there a way to check whether the user is using homepage or dashboard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2020 05:53 AM
Hello Team,
I m trying to check the whether the using homepage or dashboard by default.. I created a report of user preference table and trying to give some conditions based on name"my_home_navigation_page" and value is not'' $pa_dashboard.do" but im not getting the accurate report.
can anyone help me with the condition here.
Many thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2020 03:13 AM
Hi msm,
Basically user preferences value set depending upon where user navigates and it stores that data for particular user.By default homepage opens for any user in ServiceNow whereas PA dashboard opens only when user clicks on the dashboard to open in dashboards view(which is not by default).You can't create report on this table as this is a system table and 'Reporting functionality is available by default for all tables, except for system tables'. I will suggest you to try any other way or check the use case/requirement again as this is not right way.If any concerns, please let me know.
Regards,
Apurva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2022 07:13 AM
Yes there is. I would save this as a fix script so as the users migrate you can can continue to check and follow up
//user using homepages
var recs = [];
var user = new GlideRecord('sys_user_preference');
user.addQuery('value', 'default');
user.addQuery('name', 'my_home_navigation_page');
user.query();
while (user.next()) {
var rec = {};
rec.username = user.user.getDisplayValue();
rec.username_sysid = user.user.toString();
rec.hompage_sysid = '';
rec.homepage_title = '';
//what is their homepage
var landingpage = new GlideRecord('sys_user_preference');
landingpage.addQuery('user', user.user.toString());
landingpage.addQuery('name', 'homepage');
landingpage.query();
if (landingpage.next()) {
//save this homepage sys id
rec.hompage_sysid = landingpage.value.toString();
//get homepage name
var homepage = new GlideRecord('sys_portal_page');
if (homepage.get(landingpage.value.toString())) {
//store the homepage name (title)
rec.homepage_title = homepage.title.toString();
}
}
//store this user homepage info
recs.push(rec);
}
//output info
gs.print("Users using homepage: " + recs.length);
for (var i = 0; i < recs.length; i++){
var obj = recs[i];
for (var key in obj){
var value = obj[key];
gs.print(key + ": " + value);
}
gs.print("----------------------------------------------");
}
//com.snc.pa.ui.preferences_dashboards stores thier landingpage "dashboard"
//system user preference set for my_home_navigation_page to dashboards and com.snc.pa.ui.preferences_dashboards for "your default dashboard"
//we can clear com.snc.pa.ui.preferences_dashboards and homepage so they get the default settings if you want to force it on theme
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2022 03:13 PM
Thank you. This helped me. Was wondering how I would add to the script to show active users only. Thank you for your help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2023 02:37 PM
In lines 4-8, rather than:
Try: