Restrict "Requested By" User from Being Selected as Manual Approver on Change Form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi Team,
We have an additional requirement to enhance this restriction:
- The Requested By user (the person who is raising the change) should not be allowed to select themselves as a Manual Approver.
In other words, when a user raises a change request, they should be prevented from adding themselves in the Manual Approver field.
Could anyone suggest the best way to implement this restriction?
Thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
then use before insert/update BR and handle the check and stop user from saving
(function executeRule(current, previous /* null when async */) {
if (!current.requested_by || !current.your_list_field) {
return;
}
var requestedBy = current.requested_by.toString();
var listValue = current.your_list_field.toString().split(',');
if (listValue.indexOf(requestedBy) > -1) {
gs.addErrorMessage('Requested By user cannot be present in the list.');
current.setAbortAction(true);
}
})(current, previous);
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hi @Sriram34
Create a Before Insert/Update Business Rule:
if (!current.manual_approvals.nil()) {
var approvers = current.manual_approvals.toString().split(',');
if (approvers.indexOf(current.requested_by.toString()) > -1) {
gs.addErrorMessage('Requested By user cannot be selected as a Manual Approver.');
current.setAbortAction(true);
}
}
Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards,
Bharat chavan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Hi @Sriram34
1. Best choice is to create Before (insert/update)BR , to restrict all including Add me and email address. -> Read the selected values->if it contains requested_by ->Show error message with current.setAbortAction(true);
Alternative , just fyi ( if business agrees) - it would applicable to all users:
To remove the "Add Me" button that appears next to fields like watch_list:
- Navigate to the System Dictionary of your requested_by field definition for your table
- Add no_add_me=true to the Attributes field
To prevent users from selecting requested_by by typing their email address:
- On the same dictionary entry record, add no_email=true to the Attributes list
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti