Remove options/Options control of a choice list in Agent workspace

Mathias Vandend
Mega Sage

HI,

On the incident form we have a client script running that uses a GlideAjax to filter categories based on a parameter on the incident form.

This works nicely on the normal forms, but it doesn't work on the agent workspace.

I've did some debugging and it seems that the Agent workspace does not support g_form.getControl/g_form.removeOption/g_form.addOption methods?

The info message, in the screenshot, shows the result of which categories should be visible. For this example only 1 category, Security, should be available but all the categories are still available.

find_real_file.png

Client script to remove and add the categories

//Loop through all existing category options
			var options = g_form.getControl('category').options;
			//g_form.addInfoMessage(options.length);
			for (var k = options.length; k--;){
				//Dont remove current category & -- none --
				if(options[k].value != currentCategory && options[k].value != ''){
					//g_form.addInfoMessage('Remove option ' + k + options[k].value);
					g_form.removeOption('category', options[k].value);
				}
			}

			//g_form.addOption('category','','-- None --');
			for( var i=0 ; i < answer.length ; i++) { //Loop into the array
				//g_form.addInfoMessage(answer[i].name + " - " + answer[i].value);
				if(answer[i] != currentCategory){
					g_form.addOption('category', answer[i].value, answer[i].name);
				}
			}

 

5 REPLIES 5

Drew Carpenter
Tera Expert

Has anyone run into the opposite? We're seeing that our client scripts work in Agent Workspace, but NOT native UI.
We are still stuck with one big problem - we see the correct choices on a brand-new ticket (in AW), in this case a Case, but then we can't change to a different option after save.