- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-31-2021 10:21 PM
Hi,
I want to create a mail script and it should be called from email template. How can I achieve getting different outputs from same mail script dynamically. Can we achieve this by passing through any parameters in the email scripts. Is there any mechanism to pass parameters to mail script from email template. At present for every variable I am creating a unique mail script to get the value Is there any way to get the variables dynamically from a single mail script i.e called from email template.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2021 02:31 AM
Hi,
You cannot pass any parameter etc to email script unless you are triggering the notification via eventQueue
3rd or 4th parameter you can use to send some data
gs.eventQueue('event_name', obj, 'my-data','');
Then access the data in email script using event.parm1
Regards
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
‎02-01-2021 01:07 AM
Hi,
You can use same email script with different content based on the notification from which it is getting called.
Regards
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
‎02-01-2021 01:11 AM
Hi,
Can you explain it with an example code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2021 01:46 AM
Hi,
For your question you cannot pass any parameter to email script from email template.
If you wish to use same email script in different notifications and want to print different content then I have shared the sample script above
Regards
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
‎02-01-2021 02:03 AM
Hi,
So, There is no possibility to get different output variables from a single mail script dynamically i.e called in email template used in the same notification.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2021 02:31 AM
Hi,
You cannot pass any parameter etc to email script unless you are triggering the notification via eventQueue
3rd or 4th parameter you can use to send some data
gs.eventQueue('event_name', obj, 'my-data','');
Then access the data in email script using event.parm1
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader