Last updated work notes date and time

Mr_Blue
Tera Expert

 

Hello developers,

how to get last updated date and time of a work notes on demand.
i am writing a background script here.
Can you please guide me on this.

find_real_file.png

 

Best Regards,

11 REPLIES 11

Hey,

 

Please try :

var v= new GlideRecord('dmn_demand');
v.addQuery('number','DMND0001607');
v.query();

while(v.next()){
gs.print(v.sys_updated_on.getDisplayValue());
}

Is it possible to check,

when the state got cancelled ? can i get this dates ?

Its not been saved any where so i have to figure out a way manually

Hi,

 

So its generic Updated time. So, it may/may not necessarily be the time when state was cancelled. So, if there is a case where ticket was cancelled but comments/worknotes were updated later it will have the time updated.

So, any update made to ticket will get the Updated (sys_updated_on) time updated.

In your case of Cancel demand is there is no action that can be performed on the demand form then Yes, Updated (sys_updated_on) will have correct value i.e. the date-time when Demand was cancelled.

In addition, you can use v.sys_updated_on.getDisplayValue() to get exact date-time format.

 

Hi,

That Updated On is generic field; any update happens the value changes.

But in case if you want when did record state changed from New to In Progress etc; that you can know if table is audited;

If table is audited you can right click on form and check history List

A) How to know if table is audited

Search in dictionary for this table a field of Type Collection; check if audit field is true

find_real_file.png

information for this is stored in History Table (sys_history_line)

you can get details of all fields which changes along with their old and new value

find_real_file.png

find_real_file.png

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

@Mr.Blue 

Let me know if I have answered your question.

If so, please mark appropriate response as correct & helpful so that this thread can be closed and others can be benefited by this.

Regards
Ankur

 

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