We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Conditional Logic on Email Notifications

sseverance
Tera Contributor

For email notifications, is it possible to use conditional logic for what the email will contain? For instance, if the short description contains "application related request" then add another piece of information like the long description? 

3 REPLIES 3

joshuajacks
Kilo Sage

@sseverance 

Sure! Depending on what you're using to generate the notification, you can use a mail script:
https://www.servicenow.com/docs/r/platform-administration/c_ScriptingForEmailNotifications.html

 

Or if you're using the "send email" flow action, then you can specify the logic that creates the email body.

Ankur Bawiskar
Tera Patron

@sseverance 

yes this is feasible

you can use email script and use script there to add dynamic email body, even dynamic subject etc

Scripting for email notifications 

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

Bhargavi Patel
Kilo Guru

Hi @sseverance 

Yes. You can use Mail Scripts or Notification Email Scripts to add conditional logic to the email content.

if (current.short_description.indexOf("application related request") > -1) {
template.print(current.description);
}

This prints the long description only when the short description contains "application related request".


Please Accept the solution if it assisted you with your question & Mark this response as Helpful.