
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2014 06:18 AM
Hi all,
I think I'm trying to do something pretty simple.
I have a few variables on my catalog item form that I need to pull into an email notification. One of the fields being 'alt_poc_phone'
I've tried GlideRecord and current.variable_pool.alt_poc_phone and neither seems to work.
I've also referenced the following wiki page (Scripting for Email Notifications - ServiceNow Wiki), but something's not clicking (on my part).
Any help is greatly appreciated (with examples)
MM
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2014 04:47 AM
Mandar/Adam-
Follow up to my post. For some reason the mail script is working now. I'm not sure why it wasnt' working earlier. I guess I had a typo or something.
Here's the script that works:
<mail_script>
var item = new GlideRecord("sc_req_item");
item.addQuery("request", current.sys_id);
item.query();
while(item.next()) {
var catalogItem = item.number + ': ' + item.cat_item.getDisplayValue();
var misc = item.variable_pool.alt_poc;
template.print(catalogItem + "<br/> Field: " + misc);
}
</mail_script>
Really appreciate the feedback guys, couldn't have done this without you-
On to my next challenge

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2014 06:44 AM
Hi Matthew,
You should be able to access variables directly on Request Item Notification mails.
current.variable_pool.alt_poc_phone or current.variables.alt_poc_phone.
Could you specify if you're getting any error or warning?
Thanks,
Mandar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2014 08:03 AM
HI Mandar-
Here's what I have:
<mail_script>template.print(current.variables.alternate_poc)</mail_script>
I am getting 'undefined' as an output.
Guess my code is wrong?
Matthew
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2014 08:06 AM
Hi Matthew, according to your previous post, here's what you should try:
<mail_script>template.print(current.variables.alternate_poc);</mail_script>
Let me know if it helps, Adam.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2014 08:32 AM
Hey Adam,
Tried a couple variations:
<mail_script>
template.print(current.variable_pool.orderAlternatePOC);
template.print(current.variables.orderAlternatePOC);
template.print(current.variable.orderAlternatePOC);
</mail_script>
In all cases, I get undefined...
MM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2014 08:46 AM
The reason you may be getting stuck with this is that the variable pool is related to the Request Item, whereas the notification you're writing is on the Approval (sysapproval_approver) table (correct me if I'm wrong!). To that end, I've modified your code slightly:
<mail_script>
template.print(current.sysapproval.variable_pool.orderAlternatePOC);
template.print(current.sysapproval.variables.orderAlternatePOC);
template.print(current.sysapproval.variable.orderAlternatePOC);
</mail_script>
Have a go and see if one of these works.