How to hide a values of the Reference field using Script

Sudesh
Tera Contributor

i want to hide the certain locations of the Reference field to cnm_location table, Specific to one catalog item.

As the variable is in variable set using in multiple catalog items ,reference Qualifier will not work

how to achieve this by script?

1 ACCEPTED SOLUTION

Mahendra RC
Mega Sage

Hello Sudesh,

You can create a new variable in your variable set for example catalog_item_id and then use the onLoad client script on your variable set to set the catalog ID in this variable:

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

then in your reference qualifier you can pass the catalog Item ID

javascript:new your_script_include_name().function_name(current.variables.catalog_item_id);

and in your script include then you can apply query based on the catalog item id and return the result. So in future if you receive a similar requirement for other catalog Item you can just update the query or script in your script include to return the data accordingly.

If my answer helped you in any way then please do mark it as helpful. If it answered your question then please mark it correct and helpful. 

Thanks

View solution in original post

2 REPLIES 2

Musab Rasheed
Tera Sage
Tera Sage

Hello,

You can simply hide this field on your catalog item and create a new field and apply reference qualifier. You can even do with existing variable set but it requires coding which is not required.

Please hit like and mark my response as correct if that helps

Regards

Please hit like and mark my response as correct if that helps
Regards,
Musab

Mahendra RC
Mega Sage

Hello Sudesh,

You can create a new variable in your variable set for example catalog_item_id and then use the onLoad client script on your variable set to set the catalog ID in this variable:

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

then in your reference qualifier you can pass the catalog Item ID

javascript:new your_script_include_name().function_name(current.variables.catalog_item_id);

and in your script include then you can apply query based on the catalog item id and return the result. So in future if you receive a similar requirement for other catalog Item you can just update the query or script in your script include to return the data accordingly.

If my answer helped you in any way then please do mark it as helpful. If it answered your question then please mark it correct and helpful. 

Thanks