disabling data policy via script

tahnalos
Kilo Sage

Hello

While trying to run a script to reorganize data, I keep running into a Data Policy Error.   I'm not sure what is happening but it would appear that someone modified a data policy on the production system without testing it on the development system first.   Whatever it is, it is preventing the script from updating the data I need to update in the script.

Is there any procedure that I can use to stop data policies from running so the script can run as intended?   GlideRecord.setWorkflow (false) does not seem to have any effect.   This is a one time script so I don't want to change anything or deactivate anything unless it is absolutely necessary.

Thanks

1 ACCEPTED SOLUTION

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hello Tahnalos,



Use GlideRecord.setUseEngines(false); to disable Data policies.


View solution in original post

6 REPLIES 6

sachin_namjoshi
Kilo Patron
Kilo Patron

You can create business rule to dynamicically activate or deactivate data policy.


You can glide to sys_data_policy2 table to deactivate your data policyin question and then activate it back after data processing is done.



REgards,


Sachin


Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hello Tahnalos,



Use GlideRecord.setUseEngines(false); to disable Data policies.


that doesn't work.

Hi Pradeep,

setUseEngines(false) doesn't work in scoped application is there any other alternative?

We are using setUseEngines(false) in Scripted REST API.

Kindly sugest.

BR,

Meenal