Previous Value in Mail Script

Mark_Didrikson
ServiceNow Employee
ServiceNow Employee

Hello,

Is it possible to output a previous field value in a mail script? Something like this:



<mail_script>
var pdd = previous.due_date.getDisplayValue();
template.print('previous due ' + pdd);
</mail_script>


Thanks!

Mark Didrikson

6 REPLIES 6

vamsi
Tera Contributor

Hi Greg,



It is fantastic. But it is giving only the recent values which are updated. Is there any possibility to get the previous values from which the new values got changed.



I have a requirement similar to this but I need to display in mail script both current value and previous value when I tried to replace the current object with previous it is not working.



Thanks,


Vamsi


Mark_Didrikson
ServiceNow Employee
ServiceNow Employee

Thanks for the response. I was able to create an Event and then pass in the previous.due_date value that way.

Here is what I ended up doing:

Business Rule:



gs.eventQueue("sc_task.due.date.changes", current, gs.getUserID(), previous.due_date);


Email Notification:



<mail_script>
template.print(event.parm2);
</mail_script>


Thanks!

Mark Didrikson