Help with email script to display checkbox on email notification

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2019 03:18 AM
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
ScreenCapture #2
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2019 03:22 AM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2019 03:28 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2019 03:27 AM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2019 03:40 AM