- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-04-2018 10:40 AM
Can't work this out for the life of me, though I'd have thought it would be very simple.
When creating an Advanced condition script on a Notification (sysevent_email_action table) "current" does not refer to the Notification itself, but the record that has triggered the notification eg an Incident.
Is there any way I can get the Notification record itself? Even just get the sys_id?
Specifically what I need to do is see if the Company on the Incident has a relationship with the Notification record in the m2m table I've set up.
The help text on the record is as follows:
____________________________________________________________________________________
Use an Advanced condition to send a notification based on the current email record, changing field values, or system properties. To send the notification, your advanced condition script must set a global answer variable to true.
The Advanced condition script has access to the following global variables
- current - contains the current record from the table to which the notification is linked
- event - contains the event that triggered the notification
____________________________________________________________________________________
Any and all help very much appreciated.
Best,
Mark
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2018 11:28 AM
Hi mevans,
Advanced script condition box has only two variables accessible current(contains the current record from the table to which the notification is linked) and event.
And email_action variable is accessible in message script box not in the Advanced script box.
So to get the sys_id of notification record you might have to write query on Notification table using GlideRecord.
Please mark my answer correct and helpful if my answer helped u. Thank you.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-04-2018 11:17 AM
use this:
<mail_script>
//get the sysevent_email_action record
gs.log("email_action.getUniqueValue() = " + email_action.getDisplayValue() + " : " + email_action.getUniqueValue(), "EMAIL");
//get the sysevent record that fired this notification
gs.log("event.getUniqueValue() = " + event.getDisplayValue() + " : " + event.getUniqueValue(), "EMAIL");
</mail_script>
Please mark my answer correct and helpful if my answer helped u. Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2018 03:11 AM
Hi Rohit, thanks for the reply.
I believe this only applies in the Notification Message HTML though. I need to access the record whilst evaluating the "Advanced condition" to decide whether or not the notification should run.
Just in case I tried calling email_action in the Advanced condition and it throws:
"com.glide.script.RhinoEcmaError: "email_action" is not defined."

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2018 11:28 AM
Hi mevans,
Advanced script condition box has only two variables accessible current(contains the current record from the table to which the notification is linked) and event.
And email_action variable is accessible in message script box not in the Advanced script box.
So to get the sys_id of notification record you might have to write query on Notification table using GlideRecord.
Please mark my answer correct and helpful if my answer helped u. Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-24-2018 06:09 AM
Hi Rohit,
Thank you for this, unfortunately you're right and there is no way to do what I wanted.
In the end I hard coded the sys_id of the Notification in the advanced condition and then used that.