- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2016 11:37 AM
Hello Experts,
I have a requirement to remove State Options from State field when it gets to certain state and add new options. I'm an on load client script, but I can't remove any options nor can I add any options. Please Help!
function onLoad() {
if(state == '40'){
g_form.removeOption('state', '10');
g_form.removeOption('state', '20');
g_form.removeOption('state', '30');
g_form.addOption('state', '50', 'Execution');
g_form.addOption('state', '60', 'Release');
}
}
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
-
Team Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2016 11:50 AM
Here you go. But what about when some one changes the state?
function onLoad() {
if(g_form.getValue('state') == '40'){
g_form.removeOption('state', '10');
g_form.removeOption('state', '20');
g_form.removeOption('state', '30');
g_form.addOption('state', '50', 'Execution');
g_form.addOption('state', '60', 'Release');
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2016 11:46 AM
There is something about the IF statement.
I think it should be if(g_form.getValue('state') == '40'){
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2016 12:25 PM
Thanks Kent, that was it!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2016 11:50 AM
Here you go. But what about when some one changes the state?
function onLoad() {
if(g_form.getValue('state') == '40'){
g_form.removeOption('state', '10');
g_form.removeOption('state', '20');
g_form.removeOption('state', '30');
g_form.addOption('state', '50', 'Execution');
g_form.addOption('state', '60', 'Release');
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2016 12:02 PM
Thanks! That worked. So states are locked down and driven by the workflow until we get that point where they want to add in few states and have it be manually updated. So we're using a ui policy to make the state editable after the last step in the workflow.