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-19-2019 11:54 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2019 12:18 AM
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();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2019 12:29 AM
This will trigger all the business rules right ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2019 12:46 AM
Yes just for trying, you can keep that line as well.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2019 12:59 AM
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