List Collector onchange script not working

peter_repan
Tera Guru

Hi all,

in my catalog item I'm using List Collector with Variable attributes set as glide_list=true. This causes List Collector to display not as two lists, but as single list with search box.

find_real_file.png

I prefer this display, because records are not loaded during page load, but on demand in popup.

I would like to limit the number of selected records in the list and have my scripts prepared.

However, if I create onchange Catalog Client Script on this variable, the onchange is not fired when adding new records.

May it be, that onchange script on List Collector is not supported for this alternative display of List Collector?

Any ideas how can I limit the number of records in this type of List collector?

1 ACCEPTED SOLUTION

Hi Harsh,



which version of ServiceNow is running your instance? I have Helsinki and it does not work.


When I tried it on my personal instance which is Jakarta, then it works!


View solution in original post

10 REPLIES 10

snehabinani26
Tera Guru

Hi peter,


Can you share the script you have written.


Hi Shena,



actually the content of the script is not important.



If I have as a script a simple alert, it's never fired.



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


  alert('event triggered');


}


Harsh Vardhan
Giga Patron

Hi Peter,



i tried with simple alert() and i am able to get alert message.



find_real_file.png



find_real_file.png



find_real_file.png



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


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


          alert('hello world');


  return;


    }




    //Type appropriate comment here, and begin script below


   


}



hope it will help you