Email notification display Work Notes ONLY if they were updated

leslie8
Mega Expert

I have a requirement in email notification to show the LATEST work notes ONLY if the work notes have been updated. Is there a way to query the updated events directly in the email notification?

The mail script I have right now will display the LATEST work notes only if there are work notes, but will show the latest work notes even when the work notes are not updated.

The notification is being triggered on the condition that either the additional comments were updated or the assignment group or assigned to changes. So I can't use a simple condition builder.

I also considered the technique in this post but I'm wondering if there is a better way to do this in 2015, this post was back in 2011.

http://www.servicenowguru.com/scripting/business-rules-scripting/checking-modified-fields-script/

<mail_script>

var worknotes = current.work_notes.getJournalEntry(1);

if (worknotes !='') {

template.print("Latest Work Notes:");

template.print(current.work_notes.getJournalEntry(1));

}

</mail_script>

7 REPLIES 7

tltoulson
Kilo Sage

Hi Leslie,



I am not sure if the state changes from Business Rule to Notification but have you tried using the changes() function?



current.work_notes.changes();


Gurpreet07
Mega Sage

If current.work_notes.changes() is not working in notification then ,   When you are firing the event in business rule , there you could check that if the work_notes changed then pass "1" as one of email parameter else pass "0" and then in email notification display work_notes if the email parameter you passed from business rule is "1" .


HI Gupreet, The current.work_notes.changes() is not working in the email notification. Can you provide some more detail on how to fire the event in the business rule and then pass the parameter to the email notification? I know how to create the event in business rule, but I am having trouble with passing the parameter to email notification. I have read the wiki here but still need more help.




Events and Email Notification - ServiceNow Wiki


Email Notifications - ServiceNow Wiki



Thank you


Harish Murikina
Tera Guru

Hi Leslie,



                      current.work_notes can give recent work notes data. In email notification give condition like worknotes--> changes


Can you send the screen shot of your notifgication