- 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-11-2016 02:27 PM
Hi Shane,
I was able to get the translated value of a new column. So to answer your question it is possible and it works.
So the steps I followed:
1. Created a new field for the translated html - which you have already done
2. Fill the translated value in a random requested item (RITMXXXX)so that we can debug.
3. THen create a email notification script as above - which you have already done
4. Then create the notification template on request table for the condition you would like and then select insert and/ or update accordingly. For my case i used Assigned_to changes. In the message html of the email template i just have ${mail_script:pull_catitem_u_test_info}
5. Go the request which connects to the requested item (RITMXXXX) and then change the assigned to value and update it.
6. Go to notification email and then above right button you can preview notification. Change the request record to the one you have changed. You should be able to see the body with the translated html value.
It works perfectly fine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2016 02:36 PM
On point #2, my new translated value field is on the Catalog Item, not the Request Item. This is so for every notification email for requests being closed, I can include special information unique to the catalog item (such as "additional end-user instructions".
Will something need to be changed in this situation?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2016 02:42 PM
Hi Shane,
If it was on catalog item and if you are able to see that field under variables section of Requested item. It would be available under variable array.
so it should be gr.variables.test_info
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2016 02:51 PM
Mmm that makes sense.
Because my notification is on the Request table, and not Requested Item, I assume I will have to script in a glide call to the related sys_ID of the requested item, and then pull the u_test_info field?
Also to clarify, the new u_test_info field is not a variable on catalog item, it's a new field added directly to the form.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2016 03:00 PM
If it is a field on the form. Do you see it in the requested item? I mean is it visible on item. Can you see the value? If yes, then you should be able to access it if you were to call this way
Notification being on request table and that way we can get the sys id of the request that has the value.
var gr = new GlideRecord("sc_req_item");
gr.addQuery("request", current.sys_id);
gr.query();
while(gr.next()) {
template.print(gr.u_test_info.getDisplayValue());
}