How to hide question choices on a service catalog item
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2019 11:53 PM
I have a service catalog item containing 4 question choices.
I need 2 of these question choices hidden based on current user's logged in role.
The crucial thing is I am unable to check out how to hide thse fields even without the dependancy on a user's role.
I tried this:
g_form.removeOption('value','cym3');
g_form.removeOption('value','cym6');
'value' is question choice's value. I tried this in Catalog client script however it does not work.
I use Madrid instance.
Can anyone please help?
Thanks a lot!
Milan
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2019 03:53 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2019 04:28 PM
In addition to the help by Elijah above...you'd want to ensure you are using the variable/field name and then the selection value.
So if I had a field called:
Question - My Favorite Color is What?
Name - fav_color
Selection choices are
Question - Red
Name - red
Question Blue
Name - blue
Then it would be g_form.removeOption('fav_color', 'red');
And then in the run scripts in UI field you see in the above screenshot...if you want this to also work on Service Portal for users, then ensure you select both in that field and not just Desktop.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2019 11:26 PM
Thank you for your replies, but it stilll doesn't work, don't know what I am doing wrong...
1.) I tried this in Catalog Client Script - simply tested removing the question choices not based on role (just if it does work on its own at all...) It doesn't work - attaching screen shot with variables.
function onLoad() {
g_form.removeOption('pack_type','cym3');
g_form.removeOption('pack_type','cym6');
}
2.) tried this in Catalog UI Policy but it does not work, when it comes to "When to apply" I tried"pack_type is anything" so it should be evaluated to true and put the same script as above and it does not work anyway (please see another screen shot with "When to apply" options.
I am using Madrid.
Appreciate your help,
Milan

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2019 11:35 PM
are you testing it on portal ? if yes make sure you have set catalog client script UI Type as ALL.
make sure in your catalog client script you have set the value of choices correctly, validate if any space exist in value ?