Set Homepage Based on Role
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2018 08:08 PM
After several hours of perusing the Community and Docs sites, I turned to my faithful friend dan.cavanaugh for an assist. I was well down the path of creating a Business Rule on the sys_user table to invoke changes to the sys_user_preference table and set some homepages when he asked "why not just set the homepage when you give the user the custom role?". To which I replied, "genius!". Here's the write-up....
Scenario: Customer wants a user with a particular role to be re-directed to a specific homepage.
Solution: There are multiple ways to do this, but the method shown here is done on the sys_user_has_role table. Since the requirement is that the homepage be set based on a role, what better place to invoke the sys_user_preference than on the table that tracks when the user gets the role. Create an "After Insert" Business rule on the sys_user_has_role table with the order of 99 (so that it is not stopped by other business rules) and give the script as outlined below to set the homepage.
Advanced Business Rule:
Note: You may want to create a fix script to reinsert or update the roles for those users so that this BR would be invoked. Or simply set the homepage with a fix script for users with the existing role.
- Labels:
-
Scripting and Coding
- 6,445 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-02-2019 11:48 AM
This worked perfectly for what I needed to accomplish.
Thanks for taking the time to share your findings.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2023 07:11 AM
Hello,
Thank you for this solution but how we are going to achieve this with the dashboards but not hompege. Even if i change table name in name of user prefence, it doesn't work. Reason is the we can change the dashboard according to user preference and there is last , new updated sys ids getting updated in the sys_user_preference table. so just pusing the sysid is not helping. Plaese let me know if you have any idea on this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-15-2023 07:55 AM
This BR seems to work really well if you are assigning the role to a user. However, if that role is inherited from a group membership it never triggers. Is there a way to make it trigger with an inherited role? I'm a ServiceNow and scripting novice. Thanks so much.