- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2020 12:07 AM
Hi All,
I am trying addOption & removeOption for selection of resolution category if u_function field change. elseif option is not working, choices are incorrect
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var func = g_form.getValue('u_function');
if(func == 'cad'){
g_form.addOption('u_resolution_category','user_error');
g_form.addOption('u_resolution_category','other');
g_form.removeOption('u_resolution_category','issue');
g_form.removeOption('u_resolution_category','application-bug');
}
else if(func == 'it') {
g_form.addOption('u_resolution_category','application-bug');
g_form.addOption('u_resolution_category','other');
g_form.removeOption('u_resolution_category','issue');
g_form.removeOption('u_resolution_category','user_error');
//Type appropriate comment here, and begin script below
}
else {
g_form.addOption('u_resolution_category','issue');
g_form.addOption('u_resolution_category','other');
g_form.removeOption('u_resolution_category','application-bug');
g_form.removeOption('u_resolution_category','user_error');
}
}
When I choose the "IT" option which matches the elseif condition,but the resolution category choices are removing all options.
Please help me where I am wrong
thanks,
Swetha
Solved! Go to Solution.
- Labels:
-
Incident Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2020 12:14 AM
Hi,
Can you try replacing else-if with below.
else if(func == 'it') { alert('Inside else if');
g_form.addOption('u_resolution_category','application-bug');
g_form.addOption('u_resolution_category','other');
g_form.removeOption('u_resolution_category','issue','Issue'); //where Issue is choice label
g_form.removeOption('u_resolution_category','user_error','User Error'); //where User Error is choice label
//Type appropriate comment here, and begin script below
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2023 11:51 PM
this code seems to be not working for me :
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2023 12:33 AM
Now this code is working!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2024 02:57 AM
Hi ,
I am trying to achieve a similar requirement, I am able to do it. However, the value is setting to the first option provided using addOption() and I am not able to change values later on. Is it an expected behavior?
How can we let user change option when we have added it addOption()?
Thanks in advance.