- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-05-2024 08:42 AM
The Manager Hub user role gets assigned through the following scheduled job: Add Manager Hub user role The role assigned is: sn_mh.manager_hub_user If someone is no longer a manager, how does the role get removed?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-05-2024 11:49 AM
Hi @Community Alums ,
1. You can achieve this using flow designer without writing the script. [Highly recommended]
Documentation: https://docs.servicenow.com/bundle/quebec-servicenow-platform/page/administer/flow-designer/concept/...
2. Create an After Update Business rule on the Group table.
When to Run: Manager [changes]
Advance:
(function executeRule(current, previous /*null when async*/) { // Add your code here var gr = new GlideRecord("sys_user_has_role"); gr.addQuery("user", previous.manager); gr.addQuery("role.name", "approver_user"); gr.setLimit(1); gr.query(); if (gr.next()) { gr.deleteRecord(); } })(current, previous);
If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!
Thanks & Regards,
Sumanth Meda
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-05-2024 08:48 AM
Hi @Community Alums
You can manually remove the role. If the role is assigned to a certain group, you need to exclude the user from that group. Also, you can create a flow designer, scheduled job to do it automatically.
Regards,
Amit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-05-2024 11:49 AM
Hi @Community Alums ,
1. You can achieve this using flow designer without writing the script. [Highly recommended]
Documentation: https://docs.servicenow.com/bundle/quebec-servicenow-platform/page/administer/flow-designer/concept/...
2. Create an After Update Business rule on the Group table.
When to Run: Manager [changes]
Advance:
(function executeRule(current, previous /*null when async*/) { // Add your code here var gr = new GlideRecord("sys_user_has_role"); gr.addQuery("user", previous.manager); gr.addQuery("role.name", "approver_user"); gr.setLimit(1); gr.query(); if (gr.next()) { gr.deleteRecord(); } })(current, previous);
If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!
Thanks & Regards,
Sumanth Meda