How to insert close notes in a notification

redth
Giga Expert

Hello,

I need to insert close notes (present in the task table) in the notification which was built on requested item table.

Can you let me know how to achieve this?

Best,

Akshitha

1 ACCEPTED SOLUTION

Thanks for the clarification. In your message HTML include this:



Close notes: ${mail_script:task_close_notes}



Navigate to System Notification> Email> Notification Email Scripts and create a new record with the name: task_close_notes.



For the script: use this



var scTask = new GlideRecord('sc_task');


scTask.addQuery('request_item',current.getValue('sys_id'));


scTask.query();



if (scTask.next()) {


  if (scTask.closed_notes != "") {


      template.print(scTask.getValue('closed_notes');


  }


}


View solution in original post

19 REPLIES 19

Hello Chuck,



I have designed the notification on Requested Item (sc_req_item).


And also, this notification is applicable to only one catalog item and it has only one catalog task.


I have attached a screenshot for your reference.



Best,


Akshithanotification.PNG


Thanks for the clarification. In your message HTML include this:



Close notes: ${mail_script:task_close_notes}



Navigate to System Notification> Email> Notification Email Scripts and create a new record with the name: task_close_notes.



For the script: use this



var scTask = new GlideRecord('sc_task');


scTask.addQuery('request_item',current.getValue('sys_id'));


scTask.query();



if (scTask.next()) {


  if (scTask.closed_notes != "") {


      template.print(scTask.getValue('closed_notes');


  }


}


Hello Chuck,


I was able to achieve the requirement after removing g from the last two lines.


Thanks.



Best


Akshitha


Sorry for the confusion Akshitha. I've updated the script in case anyone else comes looking for it. I'm glad you got it working despite my terrible typing.


If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.



If you are viewing this from the community inbox you will not see the correct answer button.   If so, please review How to Mark Answers Correct From Inbox View.



Thank you


I tried the above code and I was still getting a NULL for the Closed Notes.  I have modified the code slightly and I am now getting the expected result, in Madrid.

var scTask = new GlideRecord('sc_task');
scTask.addQuery('request_item', current.getValue('sys_id'));
scTask.query();
if (scTask.next()) {
   if (scTask.closed_notes != "") {
       template.print("<strong>Closed Notes:</strong> " + scTask.close_notes.getDisplayValue());
   }
}