- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2018 03:06 PM
Hello,
I have a requirement to update a field on a sysapproval_approver table with a field from change_request table - anytime this changes. I'm trying to do this by using a BR on change_request to run after / update but no luck so far.
Condition: current.close_code.changes()
Script:
(function executeRule(current, previous /*null when async*/) {
var chg = new GlideRecord('sysapproval_approver');
chg.addQuery('sys_id', current.sys_id);
chg.query();
if(chg.next()) {
chg.u_close_code = current.close_code;
chg.update();
}
})(current, previous);
Any help would be great!
Thanks!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2018 03:29 PM
Use below script.
(function executeRule(current, previous /*null when async*/) {
var chg = new GlideRecord('sysapproval_approver');
chg.addQuery('sysapproval', current.sys_id);
chg.addQuery('state', 'requested');
chg.query();
while(chg.next()) {
chg.u_close_code = current.close_code;
chg.update();
}
})(current, previous);
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2023 11:30 AM
Hello @SanjivMeher , i need similar fucntionality but with a particular approver, trying to query with approver as well but of no luck .could you please provide some solution .Any help is appreciated.Thanks!
eg., groupGR1.addQuery('approver', groupMember1.manager);