when i select Company as HP at that time, only the associated departments of HP should be visible.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2023 04:00 AM
Hi There,
I have one requirement on Termination Catalog Item,
In that i have company and department variables, company is reference to core_company, and department is a select box type of Variable,
And If i select Company as HP then its associate departments only visible to requestor to select on the form.
and if i select HP then its associate departments are visible which is fine, but i have multiple companies and those multiple companies having multiple associated departments,
in my case, in code i have taken first company as HP , so if i select HP then the proper departments are company, but i want to select 'Dell' company, for that i have taken If Condition, and then added the associated departments, but when i select Dell at that time i'm not getting only the departments associated with Dell, im getting the Departments of Dell with that HP departments also.
Please find the code i have written.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2023 04:09 AM
@Community Alums Please update your script as follows.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
g_form.clearOptions('new_department'); //remove all options
if (newValue == 'HP')
alert('newValue');
{
g_form.addOption('new_department', '--None--', '--None--');
g_form.addOption('new_department', 'Compliance', 'Compliance');
g_form.addOption('new_department','Vendors','Vendors');
alert('testtttttttt');
}
alert('2test');
if (newValue == 'Dell')
alert('Dell Test');
{
g_form.addOption('new_department', '--None--', '--None--');
g_form.addOption('new_department', ' BMA', 'BMA');
g_form.addOption('new_department', 'Research & Prod Dev', 'Research & Prod Dev');
g_form.addOption('new_department', 'Portfolio', 'Portfolio');
alert('Dell End');
}
if (newValue == 'Lenovo')
{
alert('Lenovo');
g_form.addOption('new_department', '--None--', '--None--');
g_form.addOption('new_department', 'Tax Services', 'Tax Services');
g_form.addOption('new_department', 'Property', 'Property');
}
}
Please mark my answer helpful and correct if it manages to address your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2023 05:02 AM
hi @Sandeep Rajput ,
Thanks for your response,
i changed my script with your script but which is also not properly working, could you please help me is there any changes needed.
Thanks,
Priya

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2023 06:40 AM
@Community Alums Could you please test the script in incognito mode, sometimes the scripts are cached by the browser which causes issues,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2023 05:12 AM
Please clear out the choice values initially for every change on department. Try adding below line of code