mikeski.net kotlin java javascript hugo development

mikeski.net development blog

Update all date format fields for a transformation map

If we need to update a transformation map’s date format fields all at once, we can use a script.

Code

Here’s the code:

 
var transformSysId = "92bb2558db4388502c071f83059619d2";
var gr = new GlideRecord('sys_transform_entry');
var dateFormat = "EEE MMM d kk:mm:ss z yyyy";
gr.addQuery("map", transformSysId);
gr.query();
while(gr.next()){
  gs.debug("Target field " + gr.target_field + " and date format " + gr.date_format);
  gr.setValue("date_format", dateFormat);
  gr.update();
}