How to get the timestamp of a field?

Karla Johnson
Mega Contributor

Hello . I would like to ask how to get the timestamp of a field when it is updated?

I need to get the date on when the supervisor field updated and place the date in the timestamp field.

Everytime that the user update the value of the supervisor it will place the date on when it was updated in the "Timestamp" field. 

 

find_real_file.png find_real_file.png

 

Thanks in advance for your help 🙂

4 REPLIES 4

Wojtek Winnicki
Tera Guru

Hello @Karla Johnson 

Create Business Rule with condition "Supervisor changes" and in Action tab add action to field Timestamp and in value field add javascript:gs.nowDateTime();

Aman Kumar S
Kilo Patron

You can have a before update BR on the table

Set condition as:

Supervisor - changes

In action tab:

Timestamp - to - javascript: new GlideDateTime()

Best Regards
Aman Kumar

Community Alums
Not applicable

Hello,

Create Business rule as below - 

find_real_file.png

In Advanced, write below script -

 

(function executeRule(current, previous /*null when async*/) {

	current.u_time_stamp = gs.nowDateTime(); //add your variable name instead of u_time_stamp

})(current, previous);

find_real_file.png

 

Regards,

Akshay

Michael_Martin
Tera Contributor

so many false infos..

 

var gdt = new GlideDateTime(grsKbLatest.getValue("sys_updated_on"));
var unixTime = gdt.getNumericValue();	

 

 

This will return the amount of milliseconds since jan 1970 (aka unix timestamp)