Getting last comments on Approval record

samadam
Kilo Sage

I am trying to get the last comments on approval from workflow notification and using the following. It is showing empty. Any idea?

 

var gr1 = new GlideRecord("sysapproval_approver");
gr1.addQuery("sysapproval", current.sys_id);
gr1.query();
if (gr1.next()) {
template.print('Notes: ' + gr1.comments.getJournalEntry(1));
}

11 REPLIES 11

Sandeep Rajput
Tera Patron
Tera Patron

@samadam Can you try the following.

 

var gr1 = new GlideRecord("sysapproval_approver");
gr1.addQuery("sysapproval", current.getValue('sys_id'));
gr1.query();
if (gr1.next()) {
template.print('Notes: ' + gr1.comments.getJournalEntry(1));
}

The code prints "Notes" showing that query works but does not get the value for comments.

@samadam Did you check if the record actually had any comment on it? 

samadam
Kilo Sage

Yes, I added myself and I can see it in the activity log.