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

nikita_mironov
Kilo Guru

Client Script (end user browser): use g_form.isNewRecord() function. More info is here:
http://wiki.service-now.com/index.php?title=GlideForm_%28g_form%29#isNewRecord

Business Rule (server-side): current.operation() method. For example:
if (current.operation() == 'insert')
{
// just inserted a record
}


benn23
ServiceNow Employee
ServiceNow Employee

client side: g_form.isNewRecord()
server side: current.isValidRecord()


Mark Stanger
Giga Sage

This SNGuru post shows how to use both the client-side and server-side methods.

http://www.servicenowguru.com/scripting/client-scripts-scripting/testing-valid-record/


sandipc
Kilo Explorer

I have written the following query
sys_created_onBETWEENjavascript:gs.dateGenerate('2012-04-25','00:00:00')@javascript:gs.dateGenerate('2012-04-25','23:59:59')

But I want to get updated record then how can I write the query??


Thanks,
Sandip