After Business rule not working
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2024 01:45 AM
Hi developer,
I have created after business rule, but it dosen't work.
When I set this business rule to "before" it works.
I'm not sure why this happenes. Any suggestions?
Detail:
- When specific fields on "cmn_location" table are updated, populate that change info to "sn_grc_profile" table.
- There is annother Before Business rule which should be executed before this business rule. (update fields within cmn_location)
When: after, update
Script:
(function executeRule(current, previous /*null when async*/ ) {
var facilityId = current.sys_id;
var grFacilityEntity = new GlideRecord('sn_grc_profile');
grFacilityEntity.addQuery('cmn_location', facilityId);
grFacilityEntity.query();
while (grFacilityEntity.next()) {
grFacilityEntity.setValue('name', current.name);
grFacilityEntity.setValue('u_country', current.u_state.parent);
grFacilityEntity.setValue('u_business_area', current.u_business_area);
grFacilityEntity.setValue('u_department', current.u_business_area.u_department);
grFacilityEntity.setValue('u_company', current.u_business_area.company);
grFacilityEntity.update();
}
})(current, previous);
Thanks.
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2024 02:29 AM - edited 12-02-2024 02:29 AM
Comment the abort action and see if it changes anything?
Also add some logs in the main BR to se4e if it is even getting executed or not.
-Anurag