Retrieve work note from RITM

priyanka1028
Tera Contributor

Hi Team ,

 

I have one requirement where I need to retrieve the work note comment when RITM is closed and the date and time when it is added on RITM work note.

Please help me by providing your answer.

11 REPLIES 11

Voona Rohila
Kilo Patron
Kilo Patron

Hi @priyanka1028 

Can you please share an example?

 


Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

I want to write a background script where I want to retrieve the RITM closed complete comment from work note and date time of that comment.

Hi @priyanka1028 here is the background script

var wn;
var ritm = new GlideRecord('sc_req_item');
ritm.addQuery('sys_id','6eae90c43bc02300bfe04d72f3efc4d2');// pass ritm sysid

ritm.addQuery('state',3); // pass close complete value
ritm.query();
if(ritm.next())
{
wn = ritm.work_notes.getJournalEntry(1);// get last worknotes
}
gs.info(wn);

Regards
Harish

I have tried your script but I am not getting any output 

Please look at once on below screenshot

priyankatulla_0-1708682068351.png