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

AbhishekGardade
Giga Sage

Hello Irfan, 

Run your background script in application scope

OR

Check scope of the application and write access and where you running the background script?

Make sure you select all below checkboxes

find_real_file.png

Part of the benefit of scoped applications is they can allow or deny access from other tables. This allows them to keep 'private tables' for their application data or allow sharing of the information. This has nothing to do with the user's security, it is application-to-application security. If you go to the tables you are trying to write, you'll see an Application Access tab that defines the cross application access.

 

Please mark as Correct Answer and Helpful, if applicable.
Thanks!
Abhishek Gardade
Hexaware Technologies

Thank you,
Abhishek Gardade

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Shaik,

Can you try to run the background script in scoped app and try once?

Also can you try to get list of those business rules which are in scoped app?

alm_asset table is in Global scope

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

Hi Ankur,

 

I am getting big eroor but record is updating

 

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:

Hi Shaik,

I believe that is because there must be some business rule in this scope sn_customerservice.

 

Did you check the business rules which are affecting this?

Regards

Ankur

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