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

Chuck Tomasi
Tera Patron

Hi Akshita,



In your notification, you can use the meta string ${field_name} to get the value of the field from the record related to the notification. If I understand your question properly, you need to add this to your notification:



Close notes


${u_close_notes}



Scripting for Email Notifications - ServiceNow Wiki


Email Notifications - ServiceNow Wiki


Hello Chuck,



I have tried this already. But, it's not working


If the field is available on your incident (or other task) record, it will appear in the "Select variables" window on the right side of the message text window. (Available in the What it will contain section of the form.)



Does the field appear there?



find_real_file.png


Yes Chuck, I have selected the variable from the right side of message text window. Still it's not working