UI policy on list collectors

scottjus82
Kilo Guru

Hey all,

Is it possible to have a conditional field based on a list collector on a catalog item? I can't seem to get mine working, starting to wonder if its the way a list collector works

I need a multi line text field to show if the list collector includes "Additional hardware, not listed"

Any thoughts?

Justin

1 ACCEPTED SOLUTION

amlanpal
Kilo Sage

Hi Steve,



Please write an onChange Catalog Client Script for the item with the change of that List Collector type variable. The script should be as of below. I also have answered similar one, which you can refer: setMandatory if ListCollector contains specific value



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


      if (newValue == '') {


              g_form.setMandatory('variable_name', false); //Put the multi line type variable name which is needed to be mandatory


              g_form.setDisplay('variable_name', false); //Put the same multi line type variable name which is needed to be visible at the same time


              return;


      }


   


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


              if (newValue.toString().indexOf("sys_id") >-1) {   //Pass the sys_id of record 'Additional hardware, not listed'. You can get the sys_id of the record from the referred table


              g_form.setMandatory('variable_name', true);


              g_form.setDisplay('variable_name', true);


              }


              else


                      {


              g_form.setMandatory('variable_name', false);


              g_form.setDisplay('variable_name', false);


              }


           


      }


}



I hope this helps.Please mark correct/helpful based on impact


View solution in original post

5 REPLIES 5

Stef Kopczyk
Tera Contributor

Worked a treat for me ! Thanks for the help.