Need help on Background Script

shaik_irfan
Tera Guru

Hi,

I am running a background script to update a field in Asset table.

 

I am in global scope and kept setWorkflow(false);

 

But i am getting a message that asset table has few business rules running on scope app which are getting triggerd. how can we stop all the BR incuding scoped applicaiton BR's

 

var gr = new GlideRecord('alm_asset'); 
gr.addEncodedQuery("active=true");
gr.setLimit(100);
gr.query();
while(gr.next()){
gr.setValue('state',4);
gr.setWorkflow(false);
gr.update();
}

 

I am getting below message:

 

Cannot disable before query business rule(s) across scope boundaries (current scope: rhino.global table scope: sn_customerservice)
Cannot disable before query business rule(s) across scope boundaries (current scope: rhino.global table scope: sn_customerservice)
17 REPLIES 17

Kajal Goti
Mega Guru

Hello Shaik,

Go to business rule and check how many BR are there related to your table.

Like this,

you can set active=false whatever BR is effecting.

find_real_file.png

Please mark as Correct and Helpful,if you find any help worthy.

Omkar Mone
Mega Sage

Hi 

Can you try with this once - 

var gr = new GlideRecord('alm_asset'); 
gr.addActiveQuery();
gr.setLimit(100);
gr.query();
gr.setValue('state',4);
//gr.setWorkflow(false);
gr.updateMultiple();

This will trigger all the business rules right ?

Yes just for trying, you can keep that line as well.

Ashutosh Munot1
Kilo Patron
Kilo Patron

Hi,

 

SetWorkflow is not allowed to be called on out of the scope tables. Meaning if you are writing a script in global scope only global scope BR wont trigger and other Scope BR will trigger.

 

So you may have to run two scripts one in global and one in that scope.


Thanks,
Ashutosh