How to retrieve the contents of work_notes in the incident table

yui ozo
Tera Contributor

Hello. - Hello.
I am looking for a way to get the latest content about the "work_notes" entry in the incident table. I am trying to write the source to a script include, but I would like to know if there are other methods.

 

For example, if the latest entry for "work_notes" is "Test 1 was executed", I would like to get "Test 1 was executed" as a value.

 

Thank you in advance.

1 ACCEPTED SOLUTION

1__AnithaHV
Kilo Sage

Hi @yui ozo 

 

Please find the below thread which has the solution.

How can I get all list of work notes in incident? - ServiceNow Community

 

Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

 

Thanks & Regards,

Anitha H V

View solution in original post

2 REPLIES 2

1__AnithaHV
Kilo Sage

Hi @yui ozo 

 

Please find the below thread which has the solution.

How can I get all list of work notes in incident? - ServiceNow Community

 

Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

 

Thanks & Regards,

Anitha H V

shaikha
Tera Guru

Hi Yui,

Worknote is a journel field, to get latest work note from any table you can use getJournalEntry(1) method on server script. In your case you need work_note from incidnet table please use below script.

Note if you use getJornalEntry(-1) this will get you all worknotes available for the record.

 

var grIncident = new GlideRecord('incident');
if(grIncident.get('<sys_id>')){
var workNotes = grIncident.work_notes.getJournalEntry(1);
}

 
If my response helped you, please mark this response correct by clicking on Accept as Solution and/or Helpful. It will help other who are looking for same query.

Regards,

Shaikha.