How do I add 2 variables to the subject of an email notification?

Chiu
Mega Contributor

Hi guys,

Relatively new to this but I've managed to get as far as adding one variable to the email subject of a notification (which is sent out as part of a workflow).

I'm trying to use the following:

A new joiner account has been created for ${current.variables.first_name} ${current.variables.last_name}

The first name appears in the email subject but not the last name. If I use ${current.variables.last_name} on it's own, it works.

So either variable on its own works, but not when combined together. Is there some way I'm supposed to be separating the two variables?

Thanks!

1 ACCEPTED SOLUTION

Jim Coyne
Kilo Patron

Are you creating the Notification within the Workflow itself, or are you raising an event that the Notification will respond to?  If from within the Workflow, I would highly suggest changing it from a "Notification" activity to a "Create Event" activity.

I do not create Notification activities within a Workflow because it is a pain to modify the Notification afterwards.  You need to publish a whole new Workflow instead of just modifying a Notification record instead.  And any running workflows will not pickup the new Notification.  Not worth the headache.

View solution in original post

8 REPLIES 8

Himanshu Dubey
Giga Guru

in the BR write 

gs.eventQueue('your.event',current,abc@xyz.com);

 

in Notification 

 subject write 

${current.variables.first_name}+" "+${current.variables.last_name}

 

Ajaykumar1
Tera Guru

Hi,

I am not sure about this, but try below code in a client script :

var first_name = g_form.getValue('first_name');// variable name
var last_name = g_form.getValue('last_name');// variable name

var full_name = first_name+ "" + last_name;

//Get the workflow id  
var wf  = new Workflow ( );
var  wfId  = wf. getWorkflowFromName ( "Your_Workflow_Name" ) ; // Pass your WF name as it is

//Start workflow, passing along name : value pair(s) for mapping to variable  
wf. startFlow (wfId , null , "Workflow Name" , {"your_input_variable_name" : "full_name"} ) ; //say full_name is your input variable name defined in your WF

 

Mark If Correct/Helpful.

Regards,
Ajay

 

Allen Andreas
Administrator
Administrator

Hi,

Not really sure how it's not working...as is...but it would appear you'd need to maybe create a run script before the notification or add this script somewhere in the workflow to create a new scratchpad variable combined:

workflow.scratchpad.fullname = current.variables.first_name + "" + current.variables.last_name;

And then in the subject line for that notification you just need to do ${workflow.scratchpad.fullname}

Something like that...

 

But really, they should work separately, but without getting in to all that, this way would work too.

Please mark reply as Helpful/Correct. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Hi,

I just wanted to check in on this and see if I've provided a good solution for you. If you don't mind, can you mark my response as "Correct"? This allows the answer to pop up to the top and makes it easily when people are filtering/searching for this type of question with correct answers.

Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!