- 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' );
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2019 07:54 AM
Please post the variable and back end values of "Please select access that you need" and "Type of Access"
Something like this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2019 08:04 AM
- 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' );
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2019 08:48 AM
Prateek,
That last works. Thank you so much for you help on this.
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2019 08:53 AM
Would you mind marking the other thread correct as well?
https://community.servicenow.com/community?id=community_question&sys_id=f05b0931db507b88a39a0b55ca9619f9