Blank option on a variable

John Vo1
Tera Guru

Is there a reason why I have a blank option for one of my variable on this catalog item?

find_real_file.png

Is there something in my script that can cause this?

find_real_file.png\

I also have Read Only as a choice under this variable.

1 ACCEPTED SOLUTION

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' );
	}
}

View solution in original post

15 REPLIES 15

Please post the variable and back end values of "Please select access that you need" and "Type of Access"

Something like this.

find_real_file.png

find_real_file.png

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' );
	}
}

Prateek,

 

That last works.  Thank you so much for you help on this.

 

John

Would you mind marking the other thread correct as well?

https://community.servicenow.com/community?id=community_question&sys_id=f05b0931db507b88a39a0b55ca9619f9