How to get current catalog item into reference qualifier ?

Yugi
Tera Expert

Hi all,

Is there a way to get a current catalog item into reference qualifier of variable ? I tried current.sys_id, current.sc_cat_item.sys_id, g_form.getParameter("sys_id") but got no luck.

1 ACCEPTED SOLUTION

Alberto Consonn
ServiceNow Employee
ServiceNow Employee

Hi,

You have to create a variable like "v_cat_id" and populate its values using onLoad catalog client script:

g_form.setValue("v_cat_id", g_form.getParameter("sys_id"));

Once done, use this variable for reference qualifer.

new SIName().functionName(current.variables.v_cat_id);

Hope this will fit your need!

If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.

Thank you

Cheers
Alberto

View solution in original post

8 REPLIES 8

Alberto Consonn
ServiceNow Employee
ServiceNow Employee

Hi,

You have to create a variable like "v_cat_id" and populate its values using onLoad catalog client script:

g_form.setValue("v_cat_id", g_form.getParameter("sys_id"));

Once done, use this variable for reference qualifer.

new SIName().functionName(current.variables.v_cat_id);

Hope this will fit your need!

If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.

Thank you

Cheers
Alberto

Thank you Alberto,

Your solution is correct, I just updated the script in catalog client script a little bit as g_form.getParameter function is not recognized in SP.

Detail in the below thread

Adventures in Service Portaling: Populate Catalog Variable Values through the URL

Shweta KHAJAPUR
Tera Guru

Please try below code in reference qualifier of variable,

javascript:current.cat_item.sys_id

this should be sufficiently close

 

use instead:

javascript:cat_item=current.sys_id

assuming this is looked catalog item only.