How to get previous value in Email Notification?

vqminh
Kilo Explorer

Hello,

I'm trying to get previous value in email notification. I can get this by using Business Rule.

For example:

current.u_previous_state_string = previous.state;

But when I try to use "previous.xx" in mail script, the code didn't work:

<mail_script>

template.print("Previous State: " + previous.state);

</mail_script>

Anyone know why and how can I use "previous.xx" in right way?

Please help, thanks.

1 ACCEPTED SOLUTION

ohhgr
Kilo Sage

Hi,



As Bhavesh said, previous is not accessible in the email notification. If your emails are triggered by an event. You could use the parm1 or parm2 to pass the previous state values.



e.g.


to pass the previous state and assignement_group you can use



gs.eventQueue("event_name", current, previous_state+"||"+previous.assignment_group.getDisplayValue(), parm2);



you could access these parameters in your email notification



<mail_script>


template.print("<br/>State : "+current.parm1.split("||")[0]);


template.print("<br/>Assignment Group : "+current.parm1.split("||")[1]);


</mail_script>




Also, just out of curiosity, if you have a field called "u_previous_state_string" on your table, why don't you directly access that field in the email notification?



Thanks,
Mandar


View solution in original post

5 REPLIES 5

Sni1
Tera Contributor

Previous value is coming as undefined for the below

template.print("<br/>State : "+current.parm1.split("||")[0]);