- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-21-2019 11:37 AM
Is there a reason why I have a blank option for one of my variable on this catalog item?
Is there something in my script that can cause this?
\
I also have Read Only as a choice under this variable.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2019 08:28 AM
Try this:
function onChange(control, oldValue, newValue, isLoading) { if (isLoading || newValue === '') { return; } var test = g_form.getValue('access_needed'); //Change accordingly g_form.clearOptions('type_of_access'); if(test == 'flowcal mlp'){ //Change accordingly g_form.removeOption('type_of_access', 'read only'); g_form.addOption('type_of_access', 'edit','Edit'); } else { g_form.addOption('type_of_access', 'edit','Edit'); g_form.addOption('type_of_access', 'read only', 'Read Only' ); } }
Please mark my response as correct and helpful if it helped solved your question.
-Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2021 08:22 AM
Hi Prateek,
Just wanted to say thank you for the above post, I was having the same issue and making the below amendment as per your suggestion resolved it!
Original:
g_form.addOption('new_mailbox', 'new mailbox');
Updated:
g_form.addOption('new_mailbox', 'new mailbox', 'New mailbox');
The third option that seems to add a display value doesn't seem to be mentioned in any of the ServiceNow documentation so this was really useful to come across 🙂
Rich