
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2019 04:12 AM
Hiii,
I have requirement to create one notification and trigger multiple content mails based on some conditions.
ex: once request created there is a mail going with request has been created. so in same notification i want to change the content only for one catalog item, means for abc item, different content mail should trigger.
how can we achieve this.
Regards,
Roopa
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2019 09:14 AM
you can trigger the notification based on condition as well you can add the condition in email script .
adding sample Email script here.
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
// Add your code here
if(current.state==1){
email.setSubject('Hi Good Morning !!');
template.print('Welcome To Servicenow' + "<br/> State: " + current.state.getDisplayValue());
}
else{
email.setSubject('Hi Good Night !!');
template.print('Welcome To Servicenow Community' + "<br/> State: " + current.state.getDisplayValue());
}
})(current, template, email, email_action, event);
Note: here what i did, if my RITM state is open then notification will trigger with good morning subject else it will set the email subject good night. you can make some modification in email script based on your need.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2019 05:56 AM
Hello,
If you want to set the different content for one catalog item, I would suggest to take Allen's solution. But if you want to implement the dynamic content for multiple catalog items, then email notification scripts might be useful.
Please look into the below link for creating an email script
Regards,
Jagadeesh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2019 06:07 AM
i gone through this link, but not getting from where i have to start and how to start.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2019 05:44 AM
The easier way (not saying it's the better way, but it's not that complicated)...is the create a second notification with the contents you want to send for that one catalog item. In the conditions section for the original notification that goes out for most all, you'd just set it to be IS NOT item name like:
And then your new notification, you'd set the condition to be IS blah blah.
This is just a quick way to achieve what you want, but isn't ideal for scaling as it can get messy if you have more and more items with specific notifications.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2019 05:53 AM
Hi Allen,
yes this is easy way creating one more notification with condition as item name
But i want to achieve it through email scripts, like one Notification with different content based on item name.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2019 09:14 AM
you can trigger the notification based on condition as well you can add the condition in email script .
adding sample Email script here.
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
// Add your code here
if(current.state==1){
email.setSubject('Hi Good Morning !!');
template.print('Welcome To Servicenow' + "<br/> State: " + current.state.getDisplayValue());
}
else{
email.setSubject('Hi Good Night !!');
template.print('Welcome To Servicenow Community' + "<br/> State: " + current.state.getDisplayValue());
}
})(current, template, email, email_action, event);
Note: here what i did, if my RITM state is open then notification will trigger with good morning subject else it will set the email subject good night. you can make some modification in email script based on your need.