Stopping business rule processing on background script

tahnalos
Kilo Sage

We are attempting to retroactively update a batch of change records (about 2000) to populate a field that was developed as mandatory.   No problem there, developed a background script.

Only problem is that the script appears to be triggering business rules left, right, and center upon the update() call.   Which we don't want (one of the business rules is resetting all the approvals, a definite no-no).

Anybody have an idea on how to stop further business rule processing?   Or trigger an update without business rule processing?

Thanks

1 ACCEPTED SOLUTION

vant
Tera Expert

You want to try to add this tag to the script so that it doesn't update the Updated field, which should skip other business rules from kicking off.


gr.autoSysField(false); // so that the records don't have system updates


gr.setWorkflow(false); // so no business rules are run


View solution in original post

6 REPLIES 6

vaibhavdesai
Kilo Expert

Hello,



I had same issue once. You can use gr.setWorkflow(false);



Regards,


Vaibhav



PS: Hit answered, like, Helpful or Correct depending on the impact of the response.


SaschaWildgrube
ServiceNow Employee
ServiceNow Employee

To identify the business rules and flows that run on a record when inserting, updating, deleting, displaying or querying the record the DevTools' WhatRuns button comes in handy.

As the name suggests it shows you what runs on a record (including business rules on parent tables).

DevTools contains a truckload of re-usable functions and features for developers.

Fork at will:

https://github.com/saschawildgrube/servicenow-devtools