How to update records of a cross scope table

Hari1
Mega Sage

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();
}

 

Hari1_0-1669471222309.png

 

1 ACCEPTED SOLUTION

Craig Gruwell
Mega Sage

Hi,

 

Try adding gr.autoSysFields(false); before the gr.update()

 

View solution in original post

1 REPLY 1

Craig Gruwell
Mega Sage

Hi,

 

Try adding gr.autoSysFields(false); before the gr.update()