How to remove option from multiple choice variable type from catalog client script

sinu2
Tera Expert

Hi,

 

I am trying to remove/hide option from catalog client script ONCHANGE but not working any suggestions

 

function CallBack(response) {
		var answer = response.responseXML.documentElement.getAttribute("answer");
		var user = JSON.parse(answer);
		if (user.division != 'eaf7c8431b88001408b8ea0dad4bcb84') {
			alert('inside division if');
			//g_form.setValue('selected_division', 'office');
			g_form.removeOption('update_which_number', 'desk');
		}
1 ACCEPTED SOLUTION

Stefan Georgiev
Tera Guru

Hello @sinu2 ,

I dont think that this is possible, you can use the Select Box type of variable.:
https://www.servicenow.com/community/developer-forum/remove-option-from-a-multiple-choice-variable-w...

But there are those options as well, but I think that you fastest win is Select box:
https://www.servicenow.com/community/itsm-forum/how-to-hide-an-option-from-a-multiple-choice-variabl...

Hope that this helps you!

If the provided information answers your question, please consider marking it as Helpful and Accepting the Solution so other community users can find it faster.

All the Best,
Stefan

View solution in original post

3 REPLIES 3

Stefan Georgiev
Tera Guru

Hello @sinu2 ,

I dont think that this is possible, you can use the Select Box type of variable.:
https://www.servicenow.com/community/developer-forum/remove-option-from-a-multiple-choice-variable-w...

But there are those options as well, but I think that you fastest win is Select box:
https://www.servicenow.com/community/itsm-forum/how-to-hide-an-option-from-a-multiple-choice-variabl...

Hope that this helps you!

If the provided information answers your question, please consider marking it as Helpful and Accepting the Solution so other community users can find it faster.

All the Best,
Stefan

Now when i think bout it you can create a widget to replicate the options and add it to custom variable, but after that you are not going to see it on RITM and task, so you need to create a hidden multiple choice variable and how it only on RITM/task and you need to clear out what options you want to show there, it is not optimal but it can work.

Cheers,
Stefan

Sandeep Rajput
Tera Patron
Tera Patron

@sinu2 removeOption only works for select box variable and doesn't work for multiple choice variable.