Passing parmeter to Email Notificaiton but not able to display them

ursnani
Giga Guru

I am Calling an event in a runscript activity in   aWOrkflow as follows:

gs.eventQueue('upoint_approval_notification',current,newstartTime,newendTime);

i was able to pass the parameters to the event and i want to pass these parameter to the Email notification

this is how i have written the notificaiton.:

Body:

A planned blackout for the   ${current.variables.upb_client_id},     ${current.variables.upb_client_name} UPoint Production site will be in place from   ${newstartTime}   to   ${newendTime}.

Please ignore any TMART monitors during that timeframe.

My issue is,

i wan to pass the parameter which i am geeting from the event to the email notification and send them to a group email. i have written like the above and the parameters are not getting displayed in the Email notification when i check the logs.

Can some one please help me with this,

Thanks.

1 ACCEPTED SOLUTION

Robert Webb1
Tera Expert

Ursnani,


You should use a notification email script to pass the information from the event to the notification.



Covering our bases:


  1. Generate an event and pass the params of your choice.
  2. Create a notification email script to print the param of your choice
  3. Have a notification trigger off that very same event and call the notification email script in the body.


Example:


Let's say I have a business rule that triggers on incident state change and I pass the previous value in parm1 of the event.



I then have to create a notificaiton email script called "incident_previous_state" with the following:


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


                  template.print(event.parm1);


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



Finally I add it into where I want the information to appear in the notification body using the following:


        Previous State: ${mail_script:incident_previous_state}



Note: When using notification email scripts, you cannot place it into the subject like the normal field variables. There is a function you can use in notification email scripts to interact with the subject line.



Scripting for email notifications



Hope this helps!


View solution in original post

5 REPLIES 5

sbrnag
Mega Expert

Jaspal Singh
Mega Patron
Mega Patron

Hi Ursnani,



I guess you will have to write a mail scirpt for accessing or having variables sent out via notifications.



Link Adding cat item variables to email notification   would help you understand better.



Also, if newendtime & newstarttime are fields on form then try using ${current.newendTime} & ${current.newstartTime}


There is a lot that happening in our instances.


the Tiime in the Date Time filed which are present on RITM are being converted to UTC. So i have written a code that converts the time from utc to user timezone. and the newendtime and newstartime are not the fields on the form. i getting the values from the form and converting the values and passing them through newendtime and newstartime by an event. In the EVENT LOGS i can see the converted time but the time are not going to Email notificatiions when i used them.


Robert Webb1
Tera Expert

Ursnani,


You should use a notification email script to pass the information from the event to the notification.



Covering our bases:


  1. Generate an event and pass the params of your choice.
  2. Create a notification email script to print the param of your choice
  3. Have a notification trigger off that very same event and call the notification email script in the body.


Example:


Let's say I have a business rule that triggers on incident state change and I pass the previous value in parm1 of the event.



I then have to create a notificaiton email script called "incident_previous_state" with the following:


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


                  template.print(event.parm1);


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



Finally I add it into where I want the information to appear in the notification body using the following:


        Previous State: ${mail_script:incident_previous_state}



Note: When using notification email scripts, you cannot place it into the subject like the normal field variables. There is a function you can use in notification email scripts to interact with the subject line.



Scripting for email notifications



Hope this helps!