- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2014 03:34 AM
Hi all,
(I'm new to ServiceNow)
I am looking to create an email notification, which sends an email to HR when we are notified a user is leaving the company.
I have an event in place, and the email notification is triggered and sent.
However, the issue I have is with the content of the email. When a user completes an online form within our portal, I have a reference field named "leaver". I need to capture this value, and include it within the email to HR. I thought it would show within the "fields" group, but it doesn't. Can I make it appear in there?
All help appreciated.
Ryan
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2014 04:03 AM
Hi Ryan,
I assume 'leaver' field is on online catalog item or record producer. Variable created on the catalog item or record producer are not accessible directly on the email. To pull value of variable in the email template, you will have to write below code.
<mail_script>template.print(current.variables.leaver.getDisplayValue())</mail_script>
Please mark answer as Helpful/Correct, if it was really helpful 🙂
Regards,
Solutioner
Enhance Knowledge NOW@ www.solutioningnow.com
http://www.solutioningnow.com/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2014 06:00 AM
Hi Ryan,
I think the mistake in my script was on line 8. Replace current.sysapproval with current.sys_id and try again. I'm assuming that your notification has been set to run on the Requested Item table?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2015 12:39 AM
I was just playing around with your code and noticed that I am getting populated with 'sys_id' for reference type of variables.
By any way can we get DisplayValue for reference type by using your script?