when i select Company as HP at that time, only the associated departments of HP should be visible.

Community Alums
Not applicable

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.

 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (isLoading || newValue === '') {
        return;
    }
  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');
        }
}
   
 
if i select HP then Proper Departments are coming,
if i select Dell, then departments of Dell with that departments of HP  also coming,
if i select Lenovo, then departments of Lenovo, departments of Dell, departments of HP all coming.
 
can anyone please help me, in above code where i made mistake, how can i get the proper solution.
 
Thanks,
Priya
   
   

 

 

5 REPLIES 5

Community Alums
Not applicable

Hi @Venkata Rama Kr ,

 

I have used that line in code, but still im getting same issue.

 

Please help me, what changes i need to do here.

 

Thanks,

Priya