Get Reference to sc_cat_item from Catalog Client Script

jimcagg
Kilo Explorer

I have a Catalog Client Script that applies to a Variable Set. While I can get to all of the variable within the set I need to pull back a reference to the sc_cat_item that is the parent(the form in which the variables reside) of this variable set. I see answers that say to use current.cat_item but I cannot use current in this scenario. My ultimate goal here is to be able to pull back the Model associated with the Catalog Item but if I can get any reference to the parent I would be happy. We have custom pricing and it is in a related table that needs to be queried with the Model reference.

Any help would be appreciated and thanks,

Jim

1 ACCEPTED SOLUTION

Brad Tilton
ServiceNow Employee
ServiceNow Employee

Hi Jim,



You can use $('sysparm_id').value; in a client script to get the sys_id of the catalog item and use that to look up your pricing data. I would not do a series of direct queries from your client script, but use glideajax to do all of the your querying on the server and just return a value(s) back to the client.


View solution in original post

3 REPLIES 3

Brad Tilton
ServiceNow Employee
ServiceNow Employee

Hi Jim,



You can use $('sysparm_id').value; in a client script to get the sys_id of the catalog item and use that to look up your pricing data. I would not do a series of direct queries from your client script, but use glideajax to do all of the your querying on the server and just return a value(s) back to the client.


Hi Brad,


        Thanks much that did the trick!



Jim


Would this also work in a mail script on the Request table? The request being generated by the Catalog Item of course.