- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2023 08:13 AM
Hi Team,
We have a requirement in change request - In change request we have UI button (Reset to New).
In change we are added manuall approvals. Now the change is in Assess state waiting for approvals. Some of the groups are "Approved" and other groups are "Requested" state.
If change got (reset to new) state - The approved groups are still showing in groups approvals.
How can we acheive to cancel all approvals if change reset new through Ui action button.
Thanks,
Saikrishna
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2023 08:31 AM
@thaduri sai Create a business rule on Change Request table as follows.
Here is the BR script.
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var approvalRec = new GlideRecord('sysapproval_approver');
approvalRec.addQuery('document_id',current.sys_id);
approvalRec.query();
while(approvalRec.next()){
approvalRec.setValue('state','not_required');
approvalRec.update();
}
})(current, previous);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2023 02:36 AM
@babbi @thaduri sai Update the BR as follows.
function executeRule(current, previous /*null when async*/) {
// Add your code here
var approvalRec = new GlideRecord('sysapproval_approver');
approvalRec.addQuery('document_id',current.sys_id);
approvalRec.query();
while(approvalRec.next()){
approvalRec.setValue('state','not_required');
approvalRec.update();
}
var approvalGroupRec = new GlideRecord('sysapproval_group');
approvalGroupRec.addQuery('parent',current.sys_id);
approvalGroupRec.query();
while(approvalGroupRec.next()){
approvalGroupRec.setValue('approval','not_required');
approvalGroupRec.update();
}
})(current, previous);
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2023 08:52 AM
Thank you so much @Sandeep Rajput ,
Am unable to see the mark it as resolve button here in commuity.
Thanks,
Saikrishna

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2023 09:05 PM
@babbi Since this question was raised through your other account (@thaduri sai), you will only find the accept solution button once you login with @thaduri sai user id.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2023 11:12 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2023 01:03 AM
Thanks a lot.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2023 04:59 AM - edited 09-23-2023 01:03 AM
Hi @Sandeep Rajput ,
After along time - Hope you are doing fine.
You have suggested above approvals script regarding change management. It is working fine as expected - But if change is requested in state one of the approver will rejected the change - (Rejected) is showing for all other requested groups also.
Here after requested approvals for 4 groups - One of the group member is rejetced the change. But Its showing rejected for all other 3 groups.
Our requirement is if rejected by someone of approver. Only that respective group will be shows as rejected. Other than groups shows as cancelled in state. Could you please help on this.
Thanks for the advance,
Thanks,
sai