Hide choices based on the domain

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2024 09:00 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2024 09:10 PM - edited 02-15-2024 09:11 PM
Hi @Community Alums ,
You can use below script in onload client script
if(g_form.getValue('sys_domain') =='<domainname>'){
g_form.removeOption('<choicefieldname>','<choicevalue>');
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2024 09:41 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2024 09:59 PM - edited 02-15-2024 10:01 PM
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>');
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2024 03:56 AM
Hi @Community Alums ,
If my response resolved your issue, please mark it as helpful and accept it as solution