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

Ashutosh,

 

Can you please what you mean i need to write 2 scripts 1 in global and another in scope.

 

If i run from scope global BR is triggering and if i write script in global scoped br are triggering

 

Hi Shaik,

As Ashutosh said setWorkflow(false) when called in global scope doesn't stop triggering any BR in custom scope

same script you need to run from custom scope

screenshot below; while running in background script select the scope you want

find_real_file.png

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

When i run in Scope i am getting 

 

GlideSession message was modified by sanitization. [message=Access to api 'setWorkflow' from scope 'sn_customerservice' has been refused due to the api's cross-scope access policy][sanitized=Access to api 'setWorkflow' from scope 'sn_customerservice' has been refused due to the api's cross-scope access policy]
Security restricted: Access to api 'setWorkflow' from scope 'sn_customerservice' has been refused due to the api's cross-scope access policy
Cannot disable before query business rule(s) across scope boundaries (current scope: rhino.global table scope: sn_customerservice)
GlideSession message was modified by sanitization. [message=Access to api 'setWorkflow' from scope 'sn_customerservice' has been refused due to the api's cross-scope access policy][sanitized=Access to api 'setWorkflow' from scope 'sn_customerservice' has been refused due to the api's cross-scope access policy]
Security restricted: Access to api 'setWorkflow' from scope 'sn_customerservice' has been refused due to the api's cross-scope access policy
Cannot disable before query business rule(s) across scope boundaries (current scope: rhino.global table scope: sn_customerservice)
GlideSession message was modified by sanitization. [message=Access to api 'setWorkflow' from scope 'sn_customerservice' has been refused due to the api's cross-scope access policy][sanitized=Access to api 'setWorkflow' from scope 'sn_customerservice' has been refused due to the api's cross-scope access policy]
Security restricted: Access to api 'setWorkflow' from scope 'sn_customerservice' has been refused due to the api's cross-scope access policy
Cannot disable before query business rule(s) across scope boundaries (current scope: rhino.global table scope: sn_customerservice)
GlideSession message was modified by sanitization. [message=Access to api 'setWorkflow' from scope 'sn_customerservice' has been refused due to the api's cross-scope access policy][sanitized=Access to api 'setWorkflow' from scope 'sn_customerservice' has been refused due to the api's cross-scope access policy]
Security restricted: Access to api 'setWorkflow' from scope 'sn_customerservice' has been refused due to the api's cross-scope access policy
Evaluator: org.mozilla.javascript.EvaluatorException: GlideRecord.setTableName - empty table name (sys_script_include.d0313e05db343700752384eb0b96199a.script; line 10) EvaluatorException(JavaScript evaluation error on:

when i run in global i am getting


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)
 

Hi Shaik,

If your records are getting updated then don't worry about the errors

the setWorkflow(false) is having that behavior and cannot be changed as it is from platform level

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader