Unable to hide Variable set variables for one catalog item.

shweta5
Giga Expert

Hi Experts,

I am unable to run my catalog UI policy on variables of Variable set  over Catalog UI Policy on Variable Set . 

I tried Catalog Client script on my catalog item to hide the variable set variables but no luck .

I am using one variable set which is being used by more than 10 catalog items . On this variable set , two catalog UI policies are running which is taking precedence over catalog item UI policy . 

Please help me out to achieve this .

 

Thanks in Advance

 

24 REPLIES 24

Hi Sheetal,

you need to check in the script whether it is portal or not and use that code accordingly to get the parameter from url

Refer updated script below

function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}

var catalogItemSysId = '';

if(window == null){

// this is portal

var url = top.location.href;
catalogItemSysId = new URLSearchParams(url).get("sys_id");

}

else{

// native

catalogItemSysId = g_form.getParameter("sysparm_id");

}

if(catalogItemSysId == 'Sys ID of ITEM'){

if (g_form.getValue('var_user_type')=='New User'){
g_form.setVisible('Variable1_name',false);
g_form.setVisible('variable2_name ',false);
}

}

}

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

I tried a lot its not working on portal . Hence dropping this plan will define  another variable set for this item . 

 

Thanks Ankur . 

no worries

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Sheetal,

Hope you are doing good.

Let me know if I have answered your question.

If so, please mark my response as correct & helpful so that this thread can be closed and others can be benefited by this.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Sheetal,

Hope you are doing good.

Would you mind marking my response as helpful/correct if I am able to resolve your query?

Regards
Ankur

 

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader