- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2016 11:53 AM
I've created a new 'translated html' field on the Catalog Item form, similar to that of "Description", to add in some more information to my catalog items.
I'd like to use this additional information in the emails that send out when the catalog item's Request (sc_request table) is closed.
Can I dot walk to the properties of my Catalog Item? Can I pull the display value of my new 'translated html' field even? I tried doing a mail script to pull the data of my new "testinfo" field, but it comes back as undefined:
<mail_script>
var gr = new GlideRecord("sc_req_item");
gr.addQuery("request", current.sys_id);
gr.query();
while(gr.next()) {
template.print(gr.testinfo.getDisplayValue());
}
</mail_script>
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-13-2016 10:40 AM
Good day,
I was able to get this working after using the following code:
var gr = new GlideRecord("sc_req_item");
gr.addQuery("request", current.sys_id);
gr.query();
while(gr.next()) {
template.print(gr.cat_item.u_test_info.getDisplayValue());
}
This works as the email notification is running off of the Request table.
Thank you for everyone's time, especially Venkat who assisted me along with this day after day.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2016 03:02 PM
Just wanted to clarify something.
The email notification is firing off of the sc_request table. I want to pull some field information from my sc_cat_item catogory item is that creating this req/ritm/task from my workflow.
The workflow ends, the ritm closes, the REQ closes from a business rule, and then my email notification fires off.
Does your example script hold true?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2016 04:20 PM
Yes it should. When we are 'getting' current, we are using the get() method to grab the current record. In your case it is a particular Request (REQ) record. This record should have at least one Requested Item (RITM). Your original script used gr as the object name, but I changed it to itmObj for better clarity as to what object (record) we are dealing with. Since the Catalog Item [sc_cat_item] is referenced from the Requested Item record, we will dot-walk to that record through the cat_item field. Since your custom field is called testinfo, you may need to change it to match the actual field name (e.g.; u_testinfo). My guess is that it will say 'undefined' because you do not say the exact field name. Try changing line to be gs.print(itmObj.cat_item.u_testinfo); instead.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2016 12:11 PM
Hi Shane,
Could you try this,
<mail_script>
var gr = new GlideRecord("sc_req_item");
gr.addQuery("request", ${sys_id});
gr.query();
template.print("Got " + gr.getRowCount() + " Records"); // log line pls remove later
while(gr.next()) {
template.print(gr.testinfo.getDisplayValue());
// if the records are coming fine and the above line doesnt work I would like to try replacing the value in paranthesis with ${gr.testinfo.getDisplayValue()}
}
</mail_script>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2016 01:36 PM
With that added in, it's being completely skipped. Not even the "Got records" line is coming through.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2016 01:48 PM
Hi Shane,
May be surround it with double quotes and check it or alternatively assign it to a local variable and then apply it in addquery. May be addquery is causing an exception with the $ in its value.
gr.addQuery("request", "${sys_id}");