How to get sys_id of email notification?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-16-2011 02:10 AM
Hello Everyone,
Can someone please tell me how to get the sys_id of the email notification in the message field.Currently when I use current.sys_id in the message field,it gives me the sysId of the record on which the event has been triggered.
I can get the sys_id using client script:g_form.getUniqueValue();
But the message field supports server side client and not client side.
Please help me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-16-2011 05:15 PM
I don't know of a very clean way to do this but you should be able to just do a simple query back to the notification table and pull back the sys_id based on the name of the notification your on.
What requirement are you trying to fulfill by pulling back the sys_id of the notification? I'm wondering if there is a different way to get what you need.
Thanks,
Kris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2011 07:04 AM
There's a couple global variables available to notification mail scripts. Just added to the wiki:
http://wiki.service-now.com/index.php?title=Scripting_for_Email_Notifications#Mail_Script_API
"email_action" is the GlideRecord of the notification (sysevent_email_action)
"event" is the GlideRecord of the event (sysevent)
<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>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2011 10:04 AM
Thanks John,it works.