Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Distinguish new record and updated record

sandipc
Kilo Explorer

How can I identify newly created record and updated record using javascript query







thanks
sandip

5 REPLIES 5

benn23
ServiceNow Employee
ServiceNow Employee

var x = new GlideRecord('your_table_name');
x.addEncodedQuery('sys_created_onBETWEENjavascript:gs.dateGenerate("2012-04-25","00:00:00")@javascript:gs.dateGenerate("2012-04-25","23:59:59")');
x.query();
while(x.next()){
x.your_field = "whatever you want";
x.update();
}