- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2022 10:36 PM
Hi all,
How to get a string value from table and assign it to a Choice field values. How can I achieve this? I have a fields Phone number, Alternative phone 1 and Alternative phone 2 and I want to fetch it from consumer and assign it to Choice Field values.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2022 10:43 PM
Hi
You can use addOption() function to achieve the same on the choice value:
The syntax will go something like:
You will need to fetch numbers in a onLoad or onChange client script: Here you can use getReference is user field is present on the form
g_form.addOption("choice_field_name", "your_phone_number","your_phone_number");
g_form.addOption("choice_field_name", "your_alt_phone_number_1","your_alt_phone_number_1");
g_form.addOption("choice_field_name", "your_alt_phone_number_2","your_alt_phone_number_2");
Feel free to mark correct, if your issue has been resolved, so it ends up in solved queue.
Will be helpful for others looking for the similar query.
Aman Kumar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2022 10:41 PM
Hi Siddharam,
How to set choice field based on string value in client scripts
Mark Correct or Helpful if it helps.
***Mark Correct or Helpful if it helps.***
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2022 10:42 PM
Hi,
What do you mean by assign? Do you want to add as an option?
You can use -
g_form.addOption("field_name", "choice_lable", "choice_value" );
to set the values for choice field use -
g_form.setValue("field_name" , ""string_value");
Take a look at kb - How to set choice field based on string value in client scripts
Feel free to mark helpful and correct!
Thanks,
Sagar Pagar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2022 10:43 PM
Hi
You can use addOption() function to achieve the same on the choice value:
The syntax will go something like:
You will need to fetch numbers in a onLoad or onChange client script: Here you can use getReference is user field is present on the form
g_form.addOption("choice_field_name", "your_phone_number","your_phone_number");
g_form.addOption("choice_field_name", "your_alt_phone_number_1","your_alt_phone_number_1");
g_form.addOption("choice_field_name", "your_alt_phone_number_2","your_alt_phone_number_2");
Feel free to mark correct, if your issue has been resolved, so it ends up in solved queue.
Will be helpful for others looking for the similar query.
Aman Kumar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2022 09:38 AM
Hi
Feel free to mark correct, if your issue has been resolved, so it ends up in solved queue.
Will be helpful for others looking for the similar query.
Aman Kumar