- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2015 11:36 PM
Hi,
I would like to update a GlideRecord with a business rule but a data policy is intercepting the update because I am not populating a mandatory field. The logic of the update is correct through, my question is: Can you update a glide record and ignore/override data policies? I have tried setWorkflow, autoSysFields and setForceUpdate (in the example below) but they don't override a data policy.
//Force an update to all User records without changing field values
var gr = new GlideRecord('sys_user');
gr.query();
while (gr.next()) {
gr.setWorkflow(false); //Do not run business rules
gr.autoSysFields(false); //Do not update system fields
gr.setForceUpdate(true); //Force the update
gr.update();
}
The instance I am working on had all of it's UI policies converted data policies but they were only designed with what the user can do, in mind. They are now preventing backend scripts from doing their job. I know I could go and modify each other them as an option, but from a technical stand point, I'd really like to know if they can just be ignored somehow.
Anyone done this before?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2017 02:09 AM
Apologies for updating an old thread, but I recently discovered this is possible. Just add:
gr.setUseEngines(false);
to the query. It's rather cryptically described on the wiki as "Disable or enable the running of any engines (approval rules / assignment rules)", but it also makes the query ignore data policies.
It's probably a bit late for this to be of any use to the original poster, but if nothing else I'll probably need this again in a few months, forget how I did it, google it and end up here again...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2015 12:44 AM
Hi Howard,
I don't think it is possible
gr.setForceUpdate //has a different meaning, it wont help you to ignore data policies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2017 12:54 AM
setUseEngines does not(no longer) disable data policies.
gr.setUseEngines(false)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2018 01:54 AM
As setUseEngines is no longer helpful for data policies, Is there an alternative ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2020 10:30 PM
Hi Nithin,
Did you found the alterative for setUseEngines function ?
looking for the alternative
Thanks and regards,
Meenal