How to put a sys_user role filter to the results of Approval Edit button?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-12-2023 09:55 AM - edited ‎02-12-2023 09:59 AM
Hi,
I need a user filtering for the selection of approvers from the RITM Approver Related List. I am able to get the filtering for the users having only itil role and not admin as approvers using the below methods:
- On the Approver list, right-click-->configure--> List Control--> Put the filter needed under Edit Default Filter
- By applying the same query condition on the UI Action of Edit button on the Approval Table.
uri.set('sysparm_query', 'roles=itil^roles!=admin');
action.setRedirectURL(uri.toString('sys_m2m_template.do'));
I get the needed filtering of users as an 'Admin' using either or both of these methods but only as an admin. When I click the Edit button as an itil user, I do not see the whole list. Somehow the roles gets converted to keywords for an itil user and renders incomplete or empty list.
Impersonation of an itil user
What am I missing here? I need all users to be able to see the same list of users that an admin can see. But for an itil user, even though they can see the list of users outside the edit button, the selection only shows limited uers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-12-2023 08:20 PM
OOB edit button on approvals table:
pasted in your script:
refreshed the sc_req_item record page and clicked edit:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-12-2023 08:45 PM
Did you try the same as an itil user? It works fine for me as an admin but just not for an itil user. It replaces the roles with keyword (as shown in the screenshot) and gives incomplete filter result.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-13-2023 11:35 PM
I later learned this is a known error in ServiceNow and there is no version for the Intended Fix
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0694041
The way I've hacked around it is to create a Read ACL for itil users for the field Roles on sys_user table