7 Replies · Latest reply on Jan 3, 2018 1:16 PM by Eileen Hessmiller

    Including work notes of a closed task in email notification

      My workflow creates 3 sequential tasks. As each task closes, a notification is sent. I want to include the work note value of the just closed task in the email, but I am getting inconsistent results. The work note from the first task is included in the first notification, but the 2nd and 3rd notifications are including just the work note from the 1st - although I'm getting the 2nd work note in the 2nd email sometimes.


      I am using a mail script. Do I need to order the task records to get the correct work note from the latest task? 


      This line is in the email body:



      This is my Email Script:

      (function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,

                /* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,

                /* Optional GlideRecord */ event) {

      var taskRec = new GlideRecord('sc_task'); 

      taskRec.addQuery('active', false); 

      taskRec.addQuery('request_item', current.sys_id); 



      if(taskRec.next()) { 



      })(current, template, email, email_action, event);