- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2019 10:28 AM
Hi All,
g_form.removeOption is not working in service portal for some reason.
I want to remove some option on the dropdown2 based on the selection of dropdown1.
unfortunately g_form.removeOption is not working and as a result I am seeing all the values in the dropdown2.
Can anyone suggest where I am going wrong here?
Thanks & Regards,
Sathish
Solved! Go to Solution.
- Labels:
-
Field Service Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2019 01:39 PM
You may want to consider not using the removeOption method all together, and go with building the menus for each choice from newValue. I have done something similar and structured it a bit differently:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading) {
return;
}
if (newValue == '') {
g_form.clearOptions('ipad_color');
g_form.addOption('ipad_color', '', '-- None --', 0);
return;
}
g_form.setValue('ipad_color', '');
g_form.clearOptions('ipad_color');
g_form.addOption('ipad_color', '', '-- None --', 0);
if (newValue == 'mini_2') {
g_form.addOption('ipad_color', 'silver', 'Silver', 1);
g_form.addOption('ipad_color', 'space_gray', 'Space Gray', 2);
}
if (newValue == 'air_2' || newValue == 'mini_4') {
g_form.addOption('ipad_color', 'gold', 'Gold', 1);
g_form.addOption('ipad_color', 'silver', 'Silver', 2);
g_form.addOption('ipad_color', 'space_gray', 'Space Gray', 3);
}
if (newValue == 'pro_97' || newValue == 'pro_129') {
g_form.addOption('ipad_color', 'gold', 'Gold', 1);
g_form.addOption('ipad_color', 'rose_gold', 'Rose Gold', 2);
g_form.addOption('ipad_color', 'silver', 'Silver', 3);
g_form.addOption('ipad_color', 'space_gray', 'Space Gray', 4);
}
}
With this example, I am clearing all the options and setting the first option to be -- None -- if newValue is blank. Unclear if you are using -- None -- as a choice, but that is why it is there.
Then I set the value of the menu to be built with nothing, then clear all of the options.
Then I check the value of newValue (this is the same as your req_type variable) and process from there. I add a number to indicate the choice order to make things easy.
Feel free to model after this with your code and let us know if this is more successful.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2019 10:49 AM
can you add remove values in double quotes like below?
g_form.removeOption("request_type","create_group");
Regards,
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2019 10:58 AM
Hi Sachin,
That didn't work either.
Regards,
Sathish

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2019 11:13 AM
Just remove variables. It should just be g_form.removeOption('action_need','stop_email_forward_req');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2019 11:30 AM
Hi Brian,
I tried that too, no luck with that.
Regards,
Sathish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2019 11:23 AM
what is this line doing in your script??
var reqtype = g_form.getValue("variables.req_type");
Doesn't this needs to be
var reqtype = g_form.getValue("req_type");
Please mark my response as correct and helpful if it helped solved your question.
-Thanks