- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2016 03:04 PM
With a background script, I am trying to query all of the records of my dmn_demand table, and fill in a field with matching data from another field already present on each record.
This is the code that I have tried and didn't have work. Thought I'd reach out to the community for some pointers on where I am going wrong:
var gr = new GlideRecord('dmn_demand');
- gr.query();
while (gr.next()) {
- gr.autoSysFields(false);
- gr.u_task_for = gr.u_requestedfor;
- gr.update();
}
Thank you
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2016 03:09 PM
Hi Shane,
Can you please confirm if field column name is u_requestedfor. I am assuming it should be u_requested_for.
Also add gr.setWorkflow(false); line before gr.update(); and try once.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2016 03:09 PM
Hi Shane,
Can you please confirm if field column name is u_requestedfor. I am assuming it should be u_requested_for.
Also add gr.setWorkflow(false); line before gr.update(); and try once.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-20-2016 01:45 PM
The addition of "gr.setWorkflow(false);" made it work correctlyy, thank you!
Could you please let me know exactly why adding that allowed it to work?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-20-2016 02:11 PM
Hi Shane,
While updating mass records we generally would like to fire notifications. In that case we will use the line gr.setWorkflow(false) which will turn of all BR's, notifications.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-20-2016 02:20 PM
I understand that, but was wondering my script did not make any changes until I added your line of code to stop business rules from running on each record.