- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2023 06:34 AM
Hello,
I have a requirement that is in the incident form we have field called BRIDGE INFORMATION. The field type is true/false. If the user selects the Bridge information check box , in the notification it will visible like BRIDGE REQUIRED.
If the user did not check the bridge information field , in the notification it will visible like BRIDGE NOT REQUIRED.
Attached screenshots
Can anyone suggest me notification email script to achieve this.
Thanks in advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2023 06:46 AM
hey @Servicenow de11
You need to write the mail script for this functionality
something like below
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
if (current.< your_checkbox_name> )
template.print('Required');
else
template.print('Not Required');
})(current, template, email, email_action, event);
and call the mail script in place of the field ${field_name} to ${mail_script:<your_mail_script_name}
Mark this as Helpful / Accept the Solution if this clears your issue
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2023 06:56 AM
Hello @Servicenow de11
Can you try this...!!
Step 1 : Create email script
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,/* Optional EmailOutbound */email, /* Optional GlideRecord */ email_action,/* Optional GlideRecord */
event) {
var getBridgeValue = current.getValue('u_bridge_information');
if (getBridgeValue == true || getBridgeValue == 'true') {
template.print("Bridge Required");
} else {
//if you want anything to print
}
})(current, template, email, email_action, event);
Step 2: Call mail script in your notifcation
${mail_script:BridgeRequired}
Output :
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2023 06:46 AM
hey @Servicenow de11
You need to write the mail script for this functionality
something like below
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
if (current.< your_checkbox_name> )
template.print('Required');
else
template.print('Not Required');
})(current, template, email, email_action, event);
and call the mail script in place of the field ${field_name} to ${mail_script:<your_mail_script_name}
Mark this as Helpful / Accept the Solution if this clears your issue
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2023 07:10 AM
Its working, thanks for the script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2023 06:56 AM
Hello @Servicenow de11
Can you try this...!!
Step 1 : Create email script
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,/* Optional EmailOutbound */email, /* Optional GlideRecord */ email_action,/* Optional GlideRecord */
event) {
var getBridgeValue = current.getValue('u_bridge_information');
if (getBridgeValue == true || getBridgeValue == 'true') {
template.print("Bridge Required");
} else {
//if you want anything to print
}
})(current, template, email, email_action, event);
Step 2: Call mail script in your notifcation
${mail_script:BridgeRequired}
Output :
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates