Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Disable Audit when making changes to the fields in change_request table

PraveenPadmanab
Kilo Explorer

Hi,

I am writing a script to make changes to the fields of change_request table. As this table is audited, all the changes are getting recorded and displayed in the Activity Formatter.

I need to avoid the changes to get audited in the table. Please let me know how i can accomplish this through scripting.

Thanks,
Praveen

1 REPLY 1

CapaJ
ServiceNow Employee

The only way to avoid auditing is to turn off GlideRecord's workflow for the update. This is done in script like so:



var gr = new GlideRecord("change_request");
gr.addQuery(your query here);
gr.query();
while (gr.next()) {
gr.setWorkflow(false);
gr.u_your_field = some_value;
gr.update();
}

And if you want to not update the "Updated" and "Updated by" fields, you can add gr.autoSysFields(false) to the script as well.