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

That worked, it returned now with "Got 0 Records". Does this mean it isn't able to pull down the data from sc_cat_item?


venkatiyer1
Giga Guru

Hi Shane,



It should be able to access that value. Can you also add the following before the mail script to see if ${sys_id} is working as it is designed.


${sys_id}


also check for current.sys_id and ${current.sys_id} to see which one returns the sys id value. That should fix it all. I guess that is the root issue of the above problem.


I added the following, and the output was the same sys_id all three times:



${sys_id}


${current.sys_id}


<mail_script>


template.print(current.sys_id);


</mail_script>




It shouldn't matter which I use then, no?


venkatiyer1
Giga Guru

It shouldnt then. The next i would try is this



gr.addQuery("sc_req_item.request" , "${sys_id}")



If you notice i added the table name before the column name. Once I faced a similar issue in an UI page and this fix got picked up.


I am now returning 36827 records, on the "Got x records" line. I think I am stepping one level too high at this point?