Hide Choice option of multiple choice variable in service catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2021 11:30 PM
Hi,
I have to hide choice option from multiple choice variable in catalog item
but my code is not working,here is my code :
function onLoad() {
g_form.removeOption('Select Type of request','disable_account');
}
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2021 12:02 AM
Hi Ankur,
Its not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2021 01:00 AM
Hi,
this worked for me on native
I have 3 choices and I have set apple value to hidden
function onLoad() {
//Type appropriate comment here, and begin script below
g_form.getControls('my_choice').forEach(function(e) {
if (e.value == 'apple')
e.parentElement.style.display = 'none';
});
}
Variable with 2 choices:
Output:
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-27-2021 06:38 AM
Did I answer your original question?
If my response helped you please mark it correct to close the question so that it benefits future readers as well.
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
03-01-2021 12:23 AM
Hi
Pls refer this:
https://community.servicenow.com/community?id=community_question&sys_id=71c475331b90d410ada243f6fe4bcb12
Thanks,
Murthy
Please mark my answer helpful if its solves your query.
Murthy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2021 12:26 AM
Try this code:
function onLoad() {
//Type appropriate comment here, and begin script below
var choice = document.getElementById("your complete id").parentNode.parentNode; // Use the entire id so that you can hide particular choice.
if (choice){
choice.style.visibility="hidden";
choice.style.display="none";
}
}
Thanks,
Murthy
Murthy