The CreatorCon Call for Content is officially open! Get started here.

its sending all the additional comments new ones and previous too I only want to send the latest add

kiran kumar m1
Tera Contributor

I have created a flow , whenever we change the additional comments it should send a mail to the caller mail with those additional comments , but whenever I update the additional comments , its sending all the additional comments new ones and previous too I only want to send the latest additional comments though mail, I am thinking of writing script but in email body I dont find any way to write script ? How can we achieve this ?

1 ACCEPTED SOLUTION

Abhay Kumar1
Giga Sage

@kiran kumar m1 you will have specify like ${comments:1},

please follow below servicneow document for more details scroll down to go line whether explain about comment variable to be used for any number of comment:

https://docs.servicenow.com/bundle/washingtondc-platform-administration/page/administer/notification...

Hope this will help you.

View solution in original post

11 REPLIES 11

Hi Kiran


@dgarad has given you good advice.

 

You can use getJournalEntry(1) to return the first comment only.

 

Because you are trying to trigger an email based on an update to the comments, you should set this up with an email notification.

 

Set the trigger to when 'additional comments = changes' and in the mail notification, you can insert a mail script that prints the comment by looking up the record and using the above.

 

let me know if you need more information.

@kiran kumar m1 Yes you can create an email script let's say  a name 'getLastComment' with below script

var cmt=current.comments.getJournalEntry(1);

template.print(cmt);

 

And in email template use below:

${mail_script:cmt}

 

Hope this should work for you.