Get event name and parm1 value in email script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2024 05:42 AM
Hello Everyone,
I have an event which contain multiple user sys_ids in parm1.
I want to fetch the event name and parm1 value in email script and covert to array string where parm1 value is list of users which are the recipients.
Instance version:- Vancouver
I tried with event.name but event object is not working
Event name- regulationCoordinators.users
example parm1 value:- 71826bf03710200044e0bfc8bcbe5d3b,0a826bf03710200044e0bfc8bcbe5d7a,a8f98bb0eb32010045e1a5115206fe3a
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2024 06:21 AM
Hi,
You can access vent parameter 1 and 2 in script. Below link will help
But I am not sure if it is possible to access name. Are you able to use parameter 2 to send event name, if not being used currently?
Regards,
Karthik Nagaramu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2024 06:28 AM
Hi Jitu_singh,
As previously noted, you can access event.name, event.parm1 and event.parm2. I wrote a little mail script to test that:
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
// Add your code here
var theEvent = event.name;
var theParm = event.parm1;
gs.log("Event is " + theEvent + " parm is " + theParm, "jaf");
})(current, template, email, email_action, event);
I set up a simple notification and triggered the event. When I went to the logs, both the event name and parm1 were correctly displayed.
:{)
Helpful and Correct tags are appreciated and help others to find information faster
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2024 06:31 AM
Hi,
Assuming you are triggering a notification using event & have added the mail script ${mail_script:email_script_name} in your Notification "Message HTML" field:
You can use the below email script.
Email script: