how to use variables in workflow email notifications (not from the current object)?

lukec
Kilo Contributor

Hi,

I have a workflow with a loop including an email notification activity whereby I need to populate the subject and body with variables that change on each iteration (user's name and others).

I've tried:

* workflow scratchpad variables (it appears this is not possible after reading on the community and after testing, the emails contain the same set of variables on every iteration).

* email notification script (seems I can only use the "current" object but the workflow isn't executed because of a request, it is a scheduled task so there is no request "current" data).

Any ideas on how I can achieve this?

I'd rather not send out generic emails to the affected user's with no specific information and I want to email the user's manager too so neither the user nor manager would know who the email is addressed to.

Thanks

1 ACCEPTED SOLUTION

Brent Sutton
Mega Sage

Hi Lukec,

Rather than using a email notification why don't you use the "Create Event" activity and pass the required variables as parameters in the event? You'll need to register an event for this purpose and create a notification that is triggered by this event.

The parameters can be accessed in the resulting email subject or body by using the following syntax:

${event.parm1}

${event.parm2}

 Or you can use a email script to access the event parameters:

var string = event.parm1.toString(); 
template.print(string);

 

Let me know if this helps,

 

Brent

 

 

View solution in original post

3 REPLIES 3

Brent Sutton
Mega Sage

Hi Lukec,

Rather than using a email notification why don't you use the "Create Event" activity and pass the required variables as parameters in the event? You'll need to register an event for this purpose and create a notification that is triggered by this event.

The parameters can be accessed in the resulting email subject or body by using the following syntax:

${event.parm1}

${event.parm2}

 Or you can use a email script to access the event parameters:

var string = event.parm1.toString(); 
template.print(string);

 

Let me know if this helps,

 

Brent

 

 

Thanks Brent, I hadn't thought of registering events.

All set up now and notifications are now working as desired with variables!

Inactive_Use945
Kilo Expert

Hi,

 

You can Dot walk to required attributes using table relationships.

For e.g. if you are using Incident table and want to go to Assigned To relationship.

 

Sending to user and user's manager is also possible using dot walk using the "Who will receive" tab. I have added both screen shots below