Get the updated time and date of a particular field

Palle
Tera Contributor

Hi SN community,

I want to get the updated date and time of a particular field in the business rule. How is it possible? In my requirements I want to get the updated date/time of current.comments each time a new comment added.

Thank you in advance. 

4 REPLIES 4

Tony Chatfield1
Kilo Patron
Hi, if your business rule triggers on comments changes then the timestamp will always be current.sys_updated_on

Omkar Joshi
Giga Guru

Hi,

 

Create one bussinessrule After Update. And add below condition:

 

Additional comments changes.

 

In the script part you get the value of 'updated' field.In that you get the date time.

 

var dateTime=current.sys_updated_on//get the date time.

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

So basically you want the timestamp when comments are added; you can have after update business rule on the table and condition as comments changes

script below to get the time when comments is added

var gdt = new GlideDateTime();

gs.info('Time is: ' + gdt);

But ideally the sys_updated_on on that table should tell you the time comments are updated since it is a field value getting updated

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Krishna  Penaka
Tera Expert