- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2021 03:56 AM
I need to grey out the select box choice from the variable. Like the choice should be visible but it should not be selectable.
Please can any suggest me what has to be done.
Even I have tried the below link but it is not working for me.
https://servicenowguru.com/scripting/client-scripts-scripting/removing-disabling-choice-list-options/
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2021 04:48 AM
I used this script and it worked for native and not portal
onLoad Client Script
function onLoad() {
//Type appropriate comment here, and begin script below
var control = g_form.getControl('drop_down'); // your variable name
var options = control.options;
for (var i = 0; i < options.length; i++) {
var option = options[i];
var ov=option.value;
if (ov == 'apple') {
control.options[i].disabled = 'true';
}
}
}
Native: It disabled the apple choice
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
01-18-2021 01:45 AM
Thank you for marking my response as helpful.
Did my reply answer your question?
If so, please mark appropriate response as correct & helpful so that the question will appear as resolved for others who may have a similar question in the future.
Thanks!
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
01-18-2021 07:24 PM
Hi Ankur,
I am not sure how I can do in portal please can you explain to me clearly what has to be done.
Thanks for helping for form view.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2021 09:54 PM
you will have to do some DOM manipulation which is not recommended.
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
01-18-2021 09:58 PM
Okay thanks Ankur, then we don't have solution for this other than DOM manipulation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2021 10:11 PM
Correct and I won't recommend DOM manipulation.
If my answer helped you in any way, please mark it as correct and helpful.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader