Hide choices based on the domain

Community Alums
Not applicable

Hi All, 

 

Having a requirement, 

Currently we are in multi domain instance. 

we need the hide some fields choices on the change request based on the specific domain. 

and it should work on the onload of the form. 

 

need suggestions to achieve it. 

4 REPLIES 4

Sarika S Nair1
Kilo Sage

Hi @Community Alums , 

You can use below script in onload client script

 

if(g_form.getValue('sys_domain') =='<domainname>'){

g_form.removeOption('<choicefieldname>','<choicevalue>');

}

Community Alums
Not applicable

Hi @Sarika S Nair1 

 

Thanks for the prompt response. 

The above script is not working. that domain value is not there on the form right.  So not able to set the condition by g_form method. 

Any suggestion to get this done by glide record/glide ajax.

 

Sarika S Nair1
Kilo Sage

Hi @Community Alums 

You can use either below option other than GlideAjax.I think for this simple check, glideajax is not required

1.You can bring that field in to form and hide it using  g_form.setDisplay('sys_domain',false); in the same onload client script. 

2.You can create one Display BR for storing the sys_domain value in g_scratchpad variable when ever form loads . 

and you can use that g_scratchpad variable in the onload client script.

use below line in display BR. 

  g_scratchpad.domain_name = current.sys_domain;

and In Client script use below script. 

if(g_scratchpad.domain_name =='<domainname>'){

g_form.removeOption('<choicefieldname>','<choicevalue>');

}

 

Hi @Community Alums  , 

If my response resolved your issue, please mark it as helpful and accept it as solution