- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-07-2019 11:28 AM
Hi there,
I'm working on a custom table with a choice field that gets its options dynamically filled by a Client Script that way:
g_form.addOption('<field>', <name of a table>, <label the table>);
When I open the dropdown, I see the labels as expected. But when I save the form, I suddenly see the name instead.
Example: I select "Story", but after saving, I see "rm_story".
Does anyone have an idea what I may be doing wrong?
Best regards,
Kosh
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2019 07:15 AM
I was referring to the fact there is a Table Name field type that you can use for the field. You can then look at using an INSTACEOFtask filter to get just tables that are child of task.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-07-2019 11:45 AM
So somewhat hacky but is it acceptable in your case to make the value the same of the label to simplify your life.
g_form.addOption(<fieldName>, <choiceValue>, <choiceLabel>, <targetIndex>);
Sorry not any sort of explanation but will probably work.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-07-2019 11:46 AM
This is because the system cannot find rm_story in the choice selections so it just adds the value to the choice field so you know what it is. There are two ways to get around this. Add all of the selections to the choice list and use a client script to remove them and add just the ones that are needed at that time.
The other option is to set the value and label to the same thing.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-07-2019 11:50 AM
You need to add like this and it will work correctly.
g_form.addOption('<field>', 'rm_story', 'Story');
Mark the comment as a correct answer and helpful once worked.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-07-2019 12:02 PM
Will this actually work? As drew mentioned this will not create a record in sys_choice table for this to reference after you leave the ticket.
I thought these would be the two options
g_form.addOption('<field>', 'Story', 'Story');
or ( the hard way )
In the client script
use glideajax to add this option to the sys_choice table in a script include ( or remove based on the action the user performed )
then do this
g_form.addOption('<field>', 'rm_story', 'Story');
Also depending on if this is truly dynamic and not depended on another choice list you can set up a dependency on sys_choice