BR working only when current.update() is added
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2023 08:15 AM
HI,
I have quite a situation where, I have written an AFTER INSERT BR and it worked fine and updated records in san diego.. But when the same BR did not update records in UTAH, I added the current.update() and it started updating records.
(function executeRule(current, previous /*null when async*/) {
var usrarray = [];
var item = new GlideRecord('sc_req_item');
item.addQuery('request',current.sys_id);
item.addQuery('cat_item','57be3d29b7121010189e22b5de11a937');
item.query();
if(item.next()){
var almhw = new GlideRecord('alm_hardware');
almhw.addQuery('sys_id','IN',item.variables.assets.toString());
almhw.query();
while(almhw.next()){
usrarray.push(almhw.assigned_to.getDisplayValue());
}
current.short_description = "Hardware Asset Refresh Order for User(s) - " + usrarray;
}
})(current, previous);
Any specific reason?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2023 10:42 AM
@Swetha M From the source code you shared, I am deducing that you are trying to set the value of short_description on the current record, since after business rule runs once the database operation is completed setting the current.short_description will have no impact on the value stored on the short_description field unless you use a current.update(); (which is not a recommended practice, use current.setWorkflow(false); prior to current.update() if you absolutely want to update the values in an after business rule.)
Since this is the default behaviour of the after business rule, there is no way it would have worked in releases prior to UTAH. The behaviour of After and Before business rules are release agnostic and have been pretty much consistent.