How to get sys_id of email notification?

User150433
Tera Guru

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.

3 REPLIES 3

Not applicable

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


john_roberts
Mega Guru

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>


Thanks John,it works.