stop Change Request being approved by the person who created it

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2022 01:17 AM
hi all,
we have a requirement to stop stop Change Request being approved by the person who created it. for this i have created a business rule. but unfortunately its not stopping for approve. please see below.
i write before update business and see code below
var gr = new GlideRecord('sysapproval_approver');
gr.setWorkflow(false);
gr.addQuery('sysapproval', current.sys_id);
gr.addQuery('state','!=','cancelled');
gr.query();
var foundUser = false;
while (gr.next()){
if (gr.approver == current.requested_by){
gr.setValue('state', 'cancelled');
gr.comments = 'Requested by user not allowed to be an approver';
gr.update();
foundUser = true;
}
if (foundUser)
gs.addErrorMessage("Requested by user " + current.requested_by.getDisplayValue() + " is not allowed to be an approver of this Change Request.");
}
But this not working as expected.
the change request shows cancelled but its not asking further approvals
and see approval tab
your response is much appreciated, Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2022 02:21 AM
@Community Alums I would suggest not to send the approval to the created by user. That should solve the issue.
Please mark as correct answer if this solves your issue.
ServiceNow Community Rising Star, Class of 2023

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2022 02:24 AM
hi jaheer,
the approvals will trigger automatically based on the assignment group, so if the opened by user is part of that particular group it will trigger automatic.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2022 02:58 AM
@Community Alums You can check below thread. Solved question.
Please mark as correct answer if this solves your issue.
ServiceNow Community Rising Star, Class of 2023