Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Business Rule Not running during data import

johndarroch
Tera Contributor

Trying to update a field that a created called supervisor with the full name from the user table . When I manually update the record it works fine but when I run the data source job the business rule does not run and I do have the Run Business Rule set to yes on the Transform Map.

Script

var inc = new GlideRecord('sys_user');

  1. inc.addQuery('employee_number',current.u_supervisor_id);

  1. inc.query();

if(inc.next()){

current.u_supervisor = inc.name;

      inc.update();

}

Thanks

6 REPLIES 6

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hello John,



Is the insert checkbox set to true on Busines rule? Also, can you put few log statements in the BR-script to confirm if the BR is triggered or not?


Please let me know if you have any questions.


I have the same issue. I am attempted to import users and groups from AD/LDAP. When the onAfter transform script adds members to groups or groups to users, I want a business rule to trigger from the sys_user_grmember table insert. Log lines indicate that the BR only triggers from the UI.

Tharun Neeli
Kilo Contributor

Hi Pradeep,

I have come across the same situation as @johndarroch went through, my business rule is working manually for newly created records and updated records also when i import through excel file the business rule is working for new inserted records as my business rule is After insert/Update but when i import data through Data source which i have done as people soft integration it is inserting records in user table but not triggering the business rule as i confirmed through log statement.

 

 

MGanon
Tera Guru

I don't know if it is documented but the business rule must be associated to the table into which you are importing. For example, importing users (sys_user) and groups (sys_user_group) will not trigger business rules against the sys_user_grmember table, even when associating users and groups together which creates sys_user_grmember table records.