Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2022 06:05 AM
Hi,
I need to update the records of a cross scope table I have changed my update set to that scope as well. I am trying to update the updated date field of the records using the background script. Below is my script. I am able see the message running after the background script as the records are updated but It is not actually not updating the records.
var gr = new GlideRecord("x_cmr_city_0_state_planning");
gr.addQuery("sys_updated_onONToday@javascript:gs.beginningOfToday()@javascript:gs.endOfToday()");
gr.query();
while(gr.next()){
gs.info("Number: " + gr.getValue("number"));
var updatedDate = new GlideDateTime(gr.getValue('sys_updated_on'));
updatedDate.addMonthsUTC(2);
gs.info("updatedDate:" + updatedDate);
gr.setValue("sys_updated_on", updatedDate);
gr.update();
}
Solved! Go to Solution.
1 ACCEPTED SOLUTION
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2022 06:29 AM
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2022 06:29 AM
Hi,
Try adding gr.autoSysFields(false); before the gr.update()