Want to show only the last additional comment or last work notes in notification for ritm

Sayan
Mega Contributor

I know that there is a setting in service now where I can change it from 3 to 1 in journal entry. But I don't want to do that. Also I have tried to write a mail script with all the examples available in community but that didn't work as well. Every time I am getting the last 3 updates all together.

find_real_file.png

Please advise over here

1 ACCEPTED SOLUTION

My Bad. 

Just to confirm are you using the format at

${mail_script:test123} i.e. an underscore.

If yes, when you do a preview are you selecting any specific record?

Also, can you try below script once.

(function runMailScript(current, template, email, email_action, event) {

          // Add your code here
	template.print('Worknotes'+current.work_notes.getJournalEntry(1));
	template.print('Comments '+current.comments.getJournalEntry(1));

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

 

Also, is there any specific reason for not using OOB functionality (system property)?

View solution in original post

17 REPLIES 17

My Bad. 

Just to confirm are you using the format at

${mail_script:test123} i.e. an underscore.

If yes, when you do a preview are you selecting any specific record?

Also, can you try below script once.

(function runMailScript(current, template, email, email_action, event) {

          // Add your code here
	template.print('Worknotes'+current.work_notes.getJournalEntry(1));
	template.print('Comments '+current.comments.getJournalEntry(1));

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

 

Also, is there any specific reason for not using OOB functionality (system property)?

Thank you jaspal! It works now.. however I will need only the last update to be displayed in notification. Right now it shows the last work notes as well as the last additional comments.

find_real_file.png

Is that possible to do?

Does that mean you want to display only the last field that was updated? So, if additional comments were updated it should show that while if worknotes was it should show that.

Is this what you mean?

Yes

Sayan
Mega Contributor

yes, you are correct....I just need to show the last updated thing