Using a script, is it possible to update the audit logs of an incident without activating business rules?

awright
Kilo Expert

I have recently been working on a script that transfers large numbers of incidents from one user to another. The requirement is that when the Assignment Group is changed, the audit is logged, but also that the business rules do not activate and create unwanted results (for example spamming the users with hundreds of "your incident has been transferred" emails, or reactivating closed incidents because they have been updated etc.)

So in short, can we make changes to the incident form in a script such that the audit logs and automatic system fields and audit logs ARE updated, but the Business Rules ARE NOT?

I have used the workflow and auto field controls

(i.e.
gr.setWorkflow(false);
gr.autoSysFields(false);
gr.setForceUpdate(true);)

in various combinations in order to try and make this happen, but the following seem to be the only two results:

1. Either the system fields are updated which activates business rules and causes problems
2. OR the audit does not happen, but neither do the business rules.

3 REPLIES 3

Michael Kaufman
Giga Guru

I would suggest before you run the script that you disable the Business Rule that reopens the incident, and the notification that send the transferred email. Enable the Business Rule and Email after the script. If you wanted to be creative, you could disable/enable that Business Rule and Notification within your script.

I know that is not optimal, however the current setWorkflow function will disable BOTH auditing and Business Rules.

Mike


CapaJC
ServiceNow Employee
ServiceNow Employee

It'd be nice if there were, like, a setForceAudit(true) or something like that, but Mike's right. No such beast currently.


awright
Kilo Expert

Thanks for the help, official confirmation on what the setworkflow(false) does is a big help 🙂