- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-09-2019 03:40 PM
Hello,
We are on Madrid version. I want to have a Business Rule on (sysapproval_approver) table, in which when approval is cancelled, I want to change RITM stage to request rejected. The reason for that is lot of time when approval is cancelled by System, the WF doesn't move next step.
Below is my Business Rule. Can you please help me out, how do I set the RITM stage to "Request Rejected"?
I am getting the correct output in log on gs.log statement. (Marked with Green Arrow)
Please advise.
Thanks,
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-09-2019 04:12 PM
I would ordinarily manage this via the workflow through a rejection branch. It makes it easier to support when your logic is all in one place.
With regard to your Business Rule, I can see errors in your code.
Please see corrections below:
var appr = new GlideRecord('sysapproval_approver')
if ( appr.get(current.sys_id) ) {
var ritm = new GlideRecord('sc_req_item');
if ( ritm.get(appr.sysapproval) ) {
ritm.setValue('approval','rejected');
ritm.setValue('stage','request_rejected');
ritm.update();
}
}
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-09-2019 04:12 PM
I would ordinarily manage this via the workflow through a rejection branch. It makes it easier to support when your logic is all in one place.
With regard to your Business Rule, I can see errors in your code.
Please see corrections below:
var appr = new GlideRecord('sysapproval_approver')
if ( appr.get(current.sys_id) ) {
var ritm = new GlideRecord('sc_req_item');
if ( ritm.get(appr.sysapproval) ) {
ritm.setValue('approval','rejected');
ritm.setValue('stage','request_rejected');
ritm.update();
}
}
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-09-2019 05:21 PM
Hi Paul,
Thanks for the correction. That was awesome.
Thanks,
Rajan