- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2022 12:39 AM
Can anyone please help in how to write the code in the below BR for the below scenario?
var grAppr = new GlideRecord('sysapproval_approver');
grAppr.addQuery('sysapproval', current.sysapproval);
grAppr.addQuery('u_injectorss',false);
grAppr.query();
while (grAppr.next()) {
// help me with the code
}
There are total 3 approvals. If one approval state is approved the other 2 approval states should be set to 'No Longer Required'.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2022 02:47 AM
Hello,
You have to create an after business rule :
Script :
(function executeRule(current, previous /*null when async*/ ) {
var grAppr = new GlideRecord('sysapproval_approver');
grAppr.addQuery('sysapproval', current.sysapproval);
grAppr.addQuery('u_injectorss', false);
grAppr.addQuery('approver', '!=', current.approver);
grAppr.query();
while (grAppr.next()) {
grAppr.state = "not_required";
grAppr.update();
}
})(current, previous);
Result :
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2022 03:13 AM
Thanks !!