Make CSM Email Notification Subject Line Dynamic
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Does anyone know of a way to dynamically change the subject line of an auto email notification based on logic or conditions.
Example: Using the same email notification, with same sending trigger conditions or in the same flow/subflow, insert a subject line for one client, but a different subject line for a different client.
- Labels:
-
Customer Service Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
47m ago
Hi @Mundo23
Use a Notification Email Script to evaluate conditions and override the subject line using email.setSubject().
Ref: Email Client Script Dynamically Changing Subject Line
Step 1: Create the Notification Email Script
- Navigate to System Policy > Email > Notification Email Scripts in your ServiceNow instance.
- Click New.
- Set the Name (like set_dynamic_client_subject).
- In the Script field, add your logic.
Sample code :
if (current.client == 'Client A') {
email.setSubject("Important Update for Client A: " + current.number);
} else if (current.client == 'Client B') {
email.setSubject("Important Update for Client B");
} else {
email.setSubject("General Notification: " + current.short_description);
}
Step 2: Add the Script to your Notification
- Open the Email Notification you want to send.
- Call email script from within the body : ${mail_script:set_dynamic_client_subject}