Choice List not populating when the dependent value changes. I have requirement to have a list of choices to appear when certain "business services" are selected on incident records. To accomplish this we have configured a set of choice that are de

mattyerian
Kilo Contributor

I have requirement to have a list of choices to appear when certain "business services" are selected on incident records.   To accomplish this we have configured a set of choice that are dependent on the business services.   Currently the only way to get the choice list variables to display is by saving the record.   Is there a method available to get these to change to the new values whenever the "business service" name is changed.   I have looked at the gform.addOption and gform.clearOptions and other items through a client script with little luck.

Any help would be appreciated.

1 ACCEPTED SOLUTION

In the dependent value are you giving the sys_id of the Business application or the direct value




find_real_file.png



I just tested with the reference value and it worked fine. The values are changing dynamically


View solution in original post

14 REPLIES 14

dvp
Mega Sage
Mega Sage

If you want your choice list to update dynamically based on business service then you have to write a onChange client script on business service field.




Here is the example




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



           



      g_form.clearOptions('u_choice');



   



      var cdt = g_form.getValue('u_business_appl');



   



      if(cdt == 'AAA'){



           



              g_form.addOption('u_choice', 1, 1);



              g_form.addOption('u_choice', 2, 2);



              g_form.addOption('u_choice', 3, 3);



              g_form.addOption('u_choice', 4, 4);



              g_form.addOption('u_choice', 5, 5);



              g_form.addOption('u_choice', 6, 6);



              g_form.addOption('u_choice', 7, 7);



      }



      else if(cdt == 'CCC'){



              g_form.addOption('u_choice', 1, 1);



              g_form.addOption('u_choice', 2, 2);



              g_form.addOption('u_choice', 3, 3);



              g_form.addOption('u_choice', 4, 4);



              g_form.addOption('u_choice', 5, 5);



      }



   



      else if(cdt == 'XXX'){



              g_form.addOption('u_choice', 1, 1);



              g_form.addOption('u_choice', 2, 2);



              g_form.addOption('u_choice', 3, 3);



              g_form.addOption('u_choice', 4, 4);



      }



      else



              g_form.clearOptions('u_choice');




}


mattyerian
Kilo Contributor

Thanks DVP.   I was hoping to avoid using that method.   Would a better solution be to rewrite the above script to query the choice list table and build it automatically
?


DO you have a choice values per business application in a different table ?


mattyerian
Kilo Contributor

well we were using the "Configure Choice" list to create the values to configure the drop down lists.



find_real_file.png



By using the "show choice" feature you can see the list of choices.   This is all OOTB.   Seems to me there should be a method to refresh the list without saving the form.   Ideally this would behave as the "sub category" field works for category.