- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2019 08:18 AM
I have a client script running on a sc_request table.
The script will addOptions to a state field which is a dropdown based on certain conditions.
Adding the options based on the conditions work, however when they are added they appear as blue integer values once the record is saved. I add the options like so .....g_form.addOption('state', '97', 'Development Ready'); and when i select and save the record it appears as the 97 value in blue text when it should be Development Ready in just normal black text
Do i need to add these in a backend choice list / table somewhere? If I add it to the "selected" choice list then the dropdown choices are always present which i do not want as i need to add them dynamically through the client script with the addoptions.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2019 12:44 PM
10 seconds to load the client script is extremely poor performance. I'd evaluate what is running on that form load that is bogging it down. Perhaps setting the client script order could also help. Here is a good article on how to evaluate what is affecting the form load:
Debug slow performance on the client side using Chrome
Unfortunately for what you are trying to accomplish I think the only way is to utilize onLoad() & removeOption().

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2019 08:28 AM
the values appear in blue in the list if they are not defined in the options.
if for example you have a choice with options 1,2,3
and you enter the value 4 with a script, you will see it in blue.
Check your options.
Try also to read this
I have a choice that is showing in blue.
Regards,
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2019 08:40 AM
I have them all defined in the choice list and they are all listed in the Available choices - see highlighted entries. If I move them over to Selected then they always appear no matter what and if they reside in the available column i can control adding the options through the script but then i still receive the blue text even when using their appropriate values. Also setting the choices to Inactive = false also makes them always present.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2019 09:03 AM
As Sachin stated the options show blue as they are not defined in the table. Once you save the record the field takes the underlying value and then next time the record is loaded it checks the selected choice list to determine which value to display. As you do not have the 'Development Ready' option selected for the table then it will only show the value of 97 in blue as you are getting. I suppose one way around this is to add an onLoad client script to go get the display value of the field if not present on the table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2019 10:59 AM
What is the purpose of the addOption function when I will need to add to the choice to the choice list making it appear regardless..