Last work notes in Task notification

cstangoe
Mega Guru

Hi All.

I am trying to create a business rule which will be used in a email notification for when a Task has been updated. I would like the latest work notes to appear in the notification. In the business rule script I have current.u_work_notes = current.work_notes; and in the email notification I have Lastest Work Notes ${current.u_work_notes}

This does not seem to be working...any ideas

Thanks

Chris

5 REPLIES 5

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Chris,



Use current.work_notes.getJournalEntry(-1);


Using Journal Fields - ServiceNow Wiki


Hi Pradeep Sharma



I do apologise. Would I change the script from "u_work_notes = current.work_notes" to "u_work_notes = current.work_notes.getJournalEntry(-1);" and in the email notification have Lastest Work Notes ${current.u_work_notes}?



Thanks


Chris


zica
Giga Guru

Chris


Display Business rule that will display the last wk



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


var ia = new GlideRecord('incident');


ia.query('sys_id', current.sys_id);


if ( ia.hasNext() && ia.next() )


  gs.addInfoMessage('Last action taken: ' + ia.comments.getJournalEntry(1));


})(current, previous);



Kind regards,


ZA


Do not feel shy to mark correct or helpful answer if it helps or is correct


anupama8
Tera Expert

Hi Chris,



In the email notification, instead of using ${current.u_work_notes}....use current.work_notes.getJournalEntry(1).



PS: Hit answered, like, Helpful or Correct depending on the impact of the response.