- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2022 04:48 PM
Hi,
Customer requirement is that same user should not be able to approve change request again or I can say in 2nd level approval.
I had gone through community and found out post https://servicenowguru.com/scripting/business-rules-scripting/prevent-redundant-approval-requests-servicenow/
I tried this with one more condition as current.getTableName('change_request') as I need it to to run for change_request but did not work.
Please help me out!!
Solved! Go to Solution.
- Labels:
-
Change Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2022 11:26 PM
Hi,
your requirement is to make it work only for change_request table and hence it would only run for those approvals
Won't impact any other table
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-30-2023 08:50 PM
Hi all,
I modified a script found on community to prevent an approver of change request from approving 2 times. This applies to the same approver from different group and on the same authorization stage.
Here is the BR script:
Table: sysapproval_approver
When: before , insert/update
Order: 300
var gr = new GlideRecord('sysapproval_approver'); //Indicate the table to query from
gr.addQuery('sysapproval', current.sysapproval);
gr.addQuery('approver', current.approver);
gr.addQuery('state', 'approved');
gr.query(); //Execute the query
if (gr.next()) { //While the recordset contains records, iterate through them
//Do something with the records returned
gs.addInfoMessage("Only 1 approval is allowed per approver!");
gs.addInfoMessage("2nd approval aborted for " + current.approver.name);
//current.setAbortAction(true);
current.state= 'not_required';
}
Good luck.
Chin4