Show Selected Checkbox variables in Notification

Cindy26
Tera Expert

I need to show the selected checkbox variables from a catalog item in an email notification. 

I have created the email script as follows, but isn't showing anything in the notification. 

What am I doing wrong? 

The backend names of my checkbox variables are dynamics_crm, waterquote and repe_number. 

Name of email script is: show_variables_dynamics_applications and it is against the requested item table. 

 

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

if(current.variables.dynamics_crm==true){
template.print("Dynamics CRM," + ' ' );
}
if(current.variables.waterquote==true){
template.print("WaterQuote," + ' ');
}
if(current.variables.repe_number==true){
template.print("REPE number," + ' ');
}


template.print('</p>');

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

 

Attached screenshot of notification and what it looks like, as well as the selections on the RITM. 

 

1 ACCEPTED SOLUTION

Scott Stahr
Tera Expert

I think you need quotes around the true for each if:
if(current.variables.dynamics_crm=='true'){
      template.print("Dynamics CRM," + ' ' );
}

View solution in original post

4 REPLIES 4

Scott Stahr
Tera Expert

I think you need quotes around the true for each if:
if(current.variables.dynamics_crm=='true'){
      template.print("Dynamics CRM," + ' ' );
}

I actually tried that as well but I get the same/blank result in the notification. 

 

Thank you, this was correct. I determined that I had mistyped the name of the mail script within the notification itself, so it wasn't showing it. 

Cindy26
Tera Expert

any other suggestions?