
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2023 11:58 PM
Hi All, having a requirement,
Need to hide choices of the 'State' field based on the company selection.
need to try with onLoad script any suggestions.
Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2023 12:35 AM
Hi @Community Alums with an Onload client script as below you can achieve it, I had used Location instead of Country in the below , I had hided Canceled option in the below example
function onLoad() {
if (g_form.getValue('location') == '3e94ed7437d0200044e0bfc8bcbe5d9b') {
g_form.removeOption('state','8');
}
}
Cheers, hope that helps /Eswar
*** Please mark as "Correct" or "Helpful" as appropriate ***
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2023 12:03 AM
Hi @Community Alums Please find the below community article for the solution
Cheers, hope that helps /Eswar
*** Please mark as "Correct" or "Helpful" as appropriate ***
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2023 12:06 AM
Hello @Community Alums
Ideally it should be done on onChange CLient Script. As when you change the company selection, State field will filter out choices.
g_form.removeOption(<fieldName>, <choiceValue>);
use the above line in Your script for hiding the choices.
Plz Mark my Solution as Accept and Give me thumbs up, if you find it helpful.
Regards,
Samaksh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2023 12:17 AM
Company field is not editable one, its a default value and readonly on the form when its load.
so we can try with onload ?
and company is a reference field so need to try with the getreference type.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2023 12:39 AM
Hello @Community Alums
In that case Write onLoad() Script :-
function onLoad() {
if (g_form.getValue('company') == 'sys_id') {
g_form.removeOption(<fieldName>,<choiceValue>);
}
}
Plz Mark my Solution as Accept and Give me thumbs up, if you find it helpful.
Regards,
Samaksh