- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2023 01:09 AM
Hello,
we have the requirement to create one field that contains choices from another field.
Example: -
Suppose there are two field 'A' and field 'B'. Field A is multiselect field where we can select multiple options. Whatever selected in field A those will be the choice for B. For B we have to select any one of option from those options of 'A'. When multiselect field 'A' contain only one selection then field 'B' contain that as default value. we have to make ' B ' field mandatory when 'A' field contains more than one selection.
please guide me to implement this functionality.
Thanks in advance.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2023 06:54 AM
Hi,
You need use advanced Reference qualifier on Field B like below:
javascript: "sys_idIN"+current.u_field_a
It will restrict list to options selected in 1st Field.
To achieve 2nd scenario, you need to create onChange Client script running on change of 1st field.
Use logic in your client script like below:
var first = g_form.getValue('u_field_a');
var arr = first.split(",");
if(arr.length<1){
g_form.setValue("u_field_b",newValue);
}
Thanks
Anil Lande

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2023 09:21 AM
Can you please share what you did in client script?
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2023 01:01 AM
Please PFA for the client script I wrote.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2023 01:09 AM
Hi,
You can update it like below:
var store_me = g_form.getValue('u_business_capability');
var arr = store_me.split(",");
if(arr.length<2){
g_form.setValue("u_primary_capability",newValue);
g_form.setMandatory("u_primary_capability",true);
}else{
g_form.setMandatory("u_primary_capability",true);
}
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2023 01:16 AM
hi,
The requirement is when 'business capabilities' field contain more than one capabilities then primary capability will be mandatory. If there is one capability selected in multi select field [Business Capabilities] then that capability will be default value for primary capability.
Thanks.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2023 01:55 AM
HI,
please use something like below:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
if(newValue == ''){
g_form.clearValue('u_primary_capability');
}
return;
}
var first = g_form.getValue('u_business_capability');
var arr = first.split(',');
if (arr.length < 2) {
g_form.setValue('u_primary_capability', first);
} else {
g_form.setMandatory('u_primary_capability', true);
}
}
Thanks
Anil Lande