Need help on Background Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2019 11:10 PM
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)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2019 01:00 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2019 04:17 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2019 04:36 AM
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
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2019 05:34 AM
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)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2019 07:21 AM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader