Unable to hide Variable set variables for one catalog item.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2020 05:35 AM
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
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2020 03:22 AM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2020 05:19 AM
I tried a lot its not working on portal . Hence dropping this plan will define another variable set for this item .
Thanks Ankur .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2020 06:42 AM
no worries
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2020 10:57 PM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2020 07:53 AM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader