After Business rule not working

shun6
Giga Sage

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

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