
- 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:26 AM
Hi Matthew, you can achieve this by adding a mail script to your notification and querying that catalog variable table:
<mail_script>
printVars();
function printVars() {
template.print('<b>Request Details</b>\n');
var cv = new GlideRecord('sc_item_option_mtom');
cv.addQuery('request_item', current.sysapproval);
cv.addQuery('sc_item_option.item_option_new.type', 'IN', '1, 10, 16, 18, 2, 21, 22, 3, 4, 5, 6, 7, 8, 9'); // '2, 6');
cv.addNotNullQuery('sc_item_option.value');
cv.orderBy('sc_item_option.order');
cv.addQuery('sc_item_option.value', '!=', '0');
cv.query();
while(cv.next()) {
template.print('\n' + cv.sc_item_option.item_option_new.question_text + ':\t<b>' + cv.sc_item_option.value + '</b>');
}
}
</mail_script>
This script is pretty generic, so it will work with most catalog item types. You can customize the addQuery sections to show only specific variables if required.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2014 08:18 AM
Hey Adam,
Doing a gliderecord query seems like extra work. Looking at Mandar's response, it seems like there would be a 'shorter/quicker' way to do this.
Not ruing the GlideRecord out, but seems like ServiceNow would have an easier way to get variable info
Not a sermon, just a thought
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2014 08:22 AM
Yeah, you're probably right in this instance, however you'd have to hard code multiple notifications for all of your Catalog Items if you have a lot of them. I guess I set this up originally as more of a generic routine for all of my Catalog Items to use, but if you want a specific set up for one type of item, then Mandar's suggestion would be the simpler way to go.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2016 08:11 AM
if its a reference variable its fetching the SYSID, is there any way you can get the Display value of the variable.
I have tried the Display Value, it doesn't work