- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2019 04:43 AM
Hello,
I've got no way of knowing how to even approach a problem like this.
Say I've got an email script that needs to dynamically change based on what notification it was sent out in.
e.g. a script named metadata
If a "Incident has been assigned to you" notification is sent out, I want to have an if conditional in the JS that prints X.
If a "Incident has been opened on your behalf" note is sent, I want to have the script print Y.
The data itself is easy to get, the js is easy to write, but I genuinely have no idea how to access the type of notification sent from within the script itself.
If possible, could someone quickly detail how I might find such data in general? As an example, :
/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event
I'm presuming the data is held in the event GlideRecord, but how would I access it? Is there a list of fields in there somewhere?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2019 08:16 PM
I believe email_action gives you access to the notification record (sysevent_email_action table). You should be able to dot-walk to the notification record that is being used for the email from there.
See oob email script called (lines 3 and 26): incident_take_me_to_the_incident for usage example.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2019 08:16 PM
I believe email_action gives you access to the notification record (sysevent_email_action table). You should be able to dot-walk to the notification record that is being used for the email from there.
See oob email script called (lines 3 and 26): incident_take_me_to_the_incident for usage example.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2019 10:14 PM
Thanks, this seems to be it, one follow-up:
Where would I find a list of variables accessible through the email_action parameter? Like, if a person entered this system without knowing anything about how Servicenow does their stuff, how would they find out that "name" is a variable inside email_action?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2019 09:31 PM
Hello,
this link might help you
thanks,
shrutika surwade
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2019 10:18 PM
hey ,
if you find my answer correct.
please mark Correct!
thanks,
shrutika surwade