Help with email script to display checkbox on email notification

KayB2
Kilo Contributor

Hello Guys, 

I need to send notification for approver with the summary of catalog item, however, the checkbox value appears true and false(please see ScreenCapture #1).

Please help with email script to display checkbox in email notification that shows "check" or "empty boxes" as seen on RITM's Variables(please see ScreenCapture #2)

ScreenCapture #1

find_real_file.png

 

ScreenCapture #2find_real_file.png

6 REPLIES 6

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

If the variable is selected it will show true; if not then it will show false

so instead of true you want to display as "check"

instead of false you want to display as "empty boxes"

for this you would require script and check using if else; do this for every variable of type true/false

if(current.variables.<variableName> == true){

template.print('check');

}

else{

template.print('empty boxes');

}

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hello Ankur,

 

What I meant for "check" and "empty boxes" is like the image below. Seeing it on notification the same way it appears on RITM varialbles. 

find_real_file.png

Munender Singh
Mega Sage

Hi,

You have to create a email notification script to display the check-box in the email body:

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


if(current.variables.checkbox_value=='true'){
template.print("Checkbox Name," + ' ' );
}
if(current.variables.checkbox_value2=='true'){
template.print("Checkbox Name2," + ' ');
}

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

}

Then call this email script it in your email notification using:${mail_script:name_of_email_script}

 

Regards,

Munender

Hello Munender,

Tried the script you provided but did not work There's a message on the top of email script - please see below image. 

find_real_file.png