Client Script isn't working in CSM/FSM Configurable Workspace but works in default view

cassie-le
Tera Guru

I've added a state called "Under Review" - value = 20 

I have managed to hide this from selection from users in the default view, but our analysts user the CSM/FSM configurable workspace. 

I hid this using a client script below:

All posts I have seen say to use - UI Type = All - which it has and Isolate Script = True - which it also does. 

I have put this into the global scope too and this is still the same. 

 

We want to be able to use this state when something is updated by a customer but not allow our analysts to select it.

Currently on Utah.

Client script below:

cassiele_0-1710340658353.png

Default view:

cassiele_1-1710340729294.png

 

CSM/FSM workspace view:

cassiele_2-1710340747977.png

 

 

1 ACCEPTED SOLUTION

Anurag Tripathi
Mega Patron
Mega Patron

hi,

Why not just use the below in the script

g_form.removeOption('field name', 'choice value')

 

Try this and it should work in workspace as well as classic ui.

-Anurag

View solution in original post

5 REPLIES 5

Anurag Tripathi
Mega Patron
Mega Patron

hi,

Why not just use the below in the script

g_form.removeOption('field name', 'choice value')

 

Try this and it should work in workspace as well as classic ui.

-Anurag

Hey Anurag 

 

That's great thank you! ... So I've got that to work.... but if the state is set to "Under Review" I still want the analysts to be able to see it just not select it in the list.

If it's set to that state, when I click on a case with the State = Under Review it shows blank - any ideas? 

cassiele_0-1710341344365.png

- Cassie

Hi Cassie, 

They woy to do this would be to add an onchange list on the field, if the value selected is under review you clear the value and add a message 

 

 

-Anurag

Thanks Anurag I ended up with, I needed to call a variable and then do an If statement - the below works.

function onLoad() {
   var options= Array.from(g_form.getControl('state')); //Set your target field
   var hiddenOptions = ['20']; //Add your choice values to hide here.

	var selectedChoice = g_form.getValue('state'); //Get the selected choice

   if (selectedChoice != '20') {
      g_form.removeOption('state', '20');
   }

   options.forEach(function(e){
	if(hiddenOptions.indexOf(e.value) > -1)
		e.hidden = true;

		
   });
}