
- 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
09-04-2014 04:53 AM
FYI-
This works too:
<mail_script>
template.print(current.variable_pool.orderAlternatePOC);
template.print(current.variables.orderAlternatePOC);
template.print(current.variable.orderAlternatePOC);
</mail_script>
However, referencing a variable with current only works if it is NOT a reference field. If it's a reference field, you have to use the glideRecord lookup
Hope this helps!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2016 11:52 PM
Hey Matt,
I have done almost everything to get the variables in the email notifications, but in vain. I get either 'undefined' OR just blank . Used the OOB script but its displaying as a paragraph of all the variables and not row-wise.
Do you happen to have any working code with you currently ?
I am using Geneva patch 6. Any help would be greatly appreciated !
Cheers

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2016 08:48 PM
This works for my needs in a Fuji instance. In a mail script:
for(key in current.variables){
template.print("<div><b>" + current.variables[key].getGlideObject().getQuestion().getLabel() + "</b>: " + current.variables[key].getDisplayValue() + "</div>\r\n");
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2018 06:04 AM
Is there a way to exclude one specific variable - we have a social security number field that should not be included in the notfication.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2018 03:02 PM
Yes, add an if statement in the loop and check for your variable and conditionally exclude it.