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

Sumanth16
Kilo Patron

Hi @cassie-le ,

 

Description

 g_form.modified, g_form.modifiedFields, g_form.getControl('field_name').changed, g_form.getElement('field').changed APIs will not work in agent workspace. 

Cause

At this time there are no exposed APIs on g_form to check if the form has been modified in the Agent Workspace. This is by design. This will be a product enhancement in the workspace platform.

Resolution

You will need to utilize g_scratchpad to detect changes in the value of a field in the form. The g_scratchpad object passes information from the server to the client, such as when the client requires information not available on the form. You can refer the following documentation for more information.

You will need to create a Display business rule to access the field value and store in g_scratchpad.FIELD_NAME.
g_scratchpad.FIELD_NAME = current.FIELD_NAME;

Once that is done, I can write a script like the following to detect any changes in the value of the field.

if(g_scratchpad.FIELD_NAME != g_form.getValue('FIELD_NAME')) {
alert('FIELD_NAME changed');
} else {
alert('FIELD_NAME unchanged');
}

 

If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!

 

Thanks & Regards,

Sumanth Meda