Include catalog item's properties in Request table notification email

SC10
Kilo Guru

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>

1 ACCEPTED SOLUTION

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.


View solution in original post

32 REPLIES 32

I am indeed using Geneva.



When creating a new Notification Script, it auto gives me that leading and ending code. The only other option on screen is "Newlines to HTML" which is not selected.



This is exactly what I see: http://puu.sh/oeKxB/25777a6253.png


venkatiyer1
Giga Guru

Great that helps. And how are you using the script within the tempate. Can you add a screenshot for that as well?


Also Shane i noticed your add query is now having cat_item instead of request. I see in your first script you are running this notification out of request table. Can you modify the add query to have request with current.sys_id.



Regards,


Venkat


Among the message field, I have put in: ${mail_script:pull_catitem_u_test_info}


Also Shane i noticed your add query is now having cat_item instead of request. I see in your first script you are running this notification out of request table. Can you modify the add query to have request with current.sys_id.