Clear drop down value

salu
Mega Guru

Hello,

I want to clear the drop down value.There is a default value generic

On chnange of the assignment group I need to clear the drop down and make mandatory.How it possible?

Both are not working

g_form.setValue('u_sla_category','');

  g_form.clearValue('u_sla_category') ;

Thanks

saranya

11 REPLIES 11

amaradiswamy
Kilo Sage

Hi Saranya,



Is sla category field is which data type.



Thanks and regards


Swamy


Hello Ambaradi,



SLA catagory is string field with drop down value with none.



find_real_file.png



Thanks


Saranya


Could you please share your code that you are using because g_form.setValue() and g_form.clearValue() should do the job.


anjalichoudhary
Kilo Guru

Hi Saranya,



You can create an Onchange client script on Onchnage of assignment group and use below code:



g_form.clearValue('u_sla_category');


g_form.setMandatory('u_sla_category', true);



Regards,


Anjali


Hello Anjali,




This my on chnage client script its nowrking



function onChange(control, oldValue, newValue, isLoading, isTemplate) {


  if (isLoading || newValue === '') {


  return;


  }




  var val = g_form.getValue('assignment_group');



  if(val=='c98c447ddb4d2e0006a6f9b9af961928')//EUC_Client_Support


  {


  //g_form.setValue('u_sla_category','');


// g_form.clearValue('u_sla_category');


//g_form.getControl('u_sla_category').options.length = 0


//g_form.clearOptions('u_sla_category');



//Not working any of the above line


  g_form.removeOption('u_sla_category', 'POS - Hard IMACD', 'POS - Hard IMACD'); // set value


  g_form.removeOption('u_sla_category', 'UAM Request', 'UAM Request');



  g_form.addOption('u_sla_category', 'EUC - New Device Install', 'EUC - New Device Install'); // set value


  g_form.addOption('u_sla_category', 'EUC - Existing Device IMACD', 'EUC - Existing Device IMACD');


  g_form.addOption('u_sla_category', 'EUC - Software IMACD', 'EUC - Software IMACD');


  g_form.addOption('u_sla_category', 'EUC - Voice IMACD', 'EUC - Voice IMACD');


  g_form.addOption('u_sla_category', 'Generic','Generic');




  }


  else if(val=='c18c447ddb4d2e0006a6f9b9af961933')//EUC_MAC


  {


  g_form.addOption('u_sla_category', 'EUC - New Device Install', 'EUC - New Device Install'); // set value


  g_form.addOption('u_sla_category', 'EUC - Existing Device IMACD', 'EUC - Existing Device IMACD');


  g_form.addOption('u_sla_category', 'EUC - Software IMACD', 'EUC - Software IMACD');



  g_form.removeOption('u_sla_category', 'POS - Hard IMACD', 'POS - Hard IMACD'); // set value


  g_form.removeOption('u_sla_category', 'UAM Request', 'UAM Request');


  g_form.removeOption('u_sla_category', 'EUC - Voice IMACD', 'EUC - Voice IMACD');


  g_form.removeOption('u_sla_category', 'Generic','Generic');


  }


  else if(val=='ed8c447ddb4d2e0006a6f9b9af961958')//Stores_POS




  {


  g_form.addOption('u_sla_category', 'POS - Hard IMACD', 'POS - Hard IMACD');


  g_form.addOption('u_sla_category', 'Generic','Generic');



  g_form.removeOption('u_sla_category', 'EUC - New Device Install', 'EUC - New Device Install'); // set value


  g_form.removeOption('u_sla_category', 'EUC - Existing Device IMACD', 'EUC - Existing Device IMACD');


  g_form.removeOption('u_sla_category', 'EUC - Software IMACD', 'EUC - Software IMACD');


  g_form.removeOption('u_sla_category', 'EUC - Voice IMACD', 'EUC - Voice IMACD');


  g_form.removeOption('u_sla_category', 'UAM Request', 'UAM Request');



  }


  else if(val=='93d76e42db82b600714afb541f96194c') // UAM



  {


  g_form.addOption('u_sla_category', 'UAM Request', 'UAM Request');


  g_form.addOption('u_sla_category', 'Generic','Generic');



  g_form.removeOption('u_sla_category', 'EUC - New Device Install', 'EUC - New Device Install'); // set value


  g_form.removeOption('u_sla_category', 'EUC - Existing Device IMACD', 'EUC - Existing Device IMACD');


  g_form.removeOption('u_sla_category', 'EUC - Software IMACD', 'EUC - Software IMACD');


  g_form.removeOption('u_sla_category', 'EUC - Voice IMACD', 'EUC - Voice IMACD');


  g_form.removeOption('u_sla_category', 'POS - Hard IMACD', 'POS - Hard IMACD');



  }




  //Type appropriate comment here, and begin script below



}