Can't hide fields in service operations workspace with client script

Jo_o Pedro
Tera Expert

So i have these fields that i need to hide when i open a certain task or RITM but the problem is the script just keep getting ignored. It works in the default view but it doesn't work in the Service Operation Workspace

 

in workspace

Jo_oPedro_1-1722028820526.png

In the default view

Jo_oPedro_2-1722028994615.png

And here is my catalog client script. I already tried to use "g_form.setDisplay('variables.vs_login')" since the field is in the variables section but it didn't work.

function onLoad() {
    var shortDescription = g_form.getValue('short_description');
    if (shortDescription == 'Analisar solicitação') {
        g_form.setDisplay('vs_login', false);
        g_form.setDisplay('vs_email_task', false);
        g_form.setDisplay('vs_password', false);
    }
}

 

 

 

8 REPLIES 8

AnirudhKumar
Mega Sage
Mega Sage

In your client script, have you set the UI Type field to All ?

Yes

Community Alums
Not applicable

Hi @Jo_o Pedro ,

You are good with the code and make sure your UI Type is selected as "All".

Now, you will need to create Workspace View Rule to expose the fields.

Please refer to these threads :

https://www.servicenow.com/community/next-experience-articles/how-to-create-a-workspace-experience-v...

https://www.servicenow.com/community/workforce-optimization-forum/hide-show-lists-based-on-workspace...

 

It didn't work. But my coworker found out that the script works when using "indexOf"

JooP_1-1722284340089.png