Business rule is not working when unchecked the Run Business rule from the transform Map

Jyoti Tripathi
Giga Guru

Hi,
I have noticed that once i have disabled the Run Business Rule checkbox from transform map, any business rule written on the targeted table is not running.

Below is the business rule-

JyotiTripathi_0-1690541258086.png

 

(function executeRule(current, previous /*null when async*/) {

var gr = new GlideRecord("sn_hr_core_case");
gr.addQuery("u_order_number",current.u_order_number);
gr.query();
while (gr.next()) {
	gr.u_location=current.u_location;
	gr.u_job_code=current.u_job_code;
	gr.update();
gr.setWorkflow(false);
}
})(current, previous);

 

Whenever a order number/loc/code is inserted or updated via a data load, BR is not working

@Ankur Bawiskar :could you please help...

10 REPLIES 10

anubhavritolia
Giga Sage

Hi @Jyoti Tripathi 

 

That is expected behavior. If you unchecked Run Business Rule checkbox from transform map, any Business Rule from that table won't run.

 

If you want any specific BR to be executed, you have to explicitly create Transform Script based on requirement.

 

In your case you can create onAfter Transform Script as below:

 

var gr = new GlideRecord("sn_hr_core_case");
gr.addQuery("u_order_number",target.u_order_number);
gr.query();
while (gr.next()) {
	gr.u_location=target.u_location;
	gr.u_job_code=target.u_job_code;
	gr.update();
gr.setWorkflow(false);
}

 

 

Hi @anubhavritolia : I have tried with the onAfter script, but the data load was taking much time around 3hrs for 3k records

Hi @Jyoti Tripathi 

 

Transform would take time based on scripting and other factors. There may be some more scripting and configuration.

 

Was it taking 3 hours before this script also is it happening after creating this script only?

 

Also in which table is your Transform map?

 

Ankur Bawiskar
Tera Patron

@Jyoti Tripathi 

That's correct. For your BR to run that checkbox has to be enabled.

What is the target table for your transform map?

If it's HR Case then why not use onBefore to set the fields?

Why to use onAfter?