If "Requested for " and same requested for if member of the group approval
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2024 07:24 PM
Hi Team ,
can any one please help me in this requriemnt .
If "Requested for " and same requested for if member of the group approval of the same catalog then requested for user shouldn't be able approve the request instead it should abort with some error message.
Please provide correct script or BR or Flow steps to achieve this snieriao , i have already pasted in communtiy , not working ,
can any one please provide correct scirpt . with testing results with screenshots for better understanding ,
NOTE - our requirment is
If "Requested for " and same requested for if member of the group approval of the same catalog then requested for user shouldn't be able approve the request instead it should abort with some error message.
Please provide configuration screenshots .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2024 10:22 PM
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var gr = new GlideRecord("sc_req_item");
gr.addQuery("sys_id", current.sysapproval);
gr.addQuery("cat_item.name", "Your Catalog Item Name");
gr.addQuery("request.requested_for", current.approver);
gr.query();
if (gr.hasNext()) {
gs.info("Approver is same as requested for");
current.setAbortAction(true);
}
})(current, previous);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2024 10:30 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2024 10:31 PM
the BR will be on approver table
Did you check the script I shared and enhance it?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader