List collector

servicenow14710
Tera Expert

Hello developers, based on variable on catalog item, i need to populate choices of list collector in catalog form.

Screenshot 2024-03-11 014946.png

from above table based on systeminfo( form) selected listdata field whch is list collector on form has to get choice.

Any help is appreciated . Thanks!

 

8 REPLIES 8

Harish KM
Kilo Patron
Kilo Patron

Hi @servicenow14710 here is the sample script:

 

  getChoiceValues: function(SysID) {
            var answer = [];
            var rec= new GlideRecord('tablename');
            rec.addQuery('fieldname', SysID);//field you pass from list collector should match sysid of the record your looking in table
            rec.query();
            while (rec.next()) {
                answer.push(rec.getValue('sys_id'));//push values

            }
            return "sys_idIN" + answer.join(','); // return sysid of the record
        },
 
call the above script include in your variable qualifier'
javascript: new scriptincludename().functionName(current.variables.variablename);
Regards
Harish

Sumanth16
Kilo Patron

Hi @servicenow14710 ,

 

Please refer below thread:

 

https://www.servicenow.com/community/developer-forum/filtering-list-collector-variables-based-on-dro...

 

If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!

 

Thanks & Regards,

Sumanth Meda

Tai Vu
Kilo Patron
Kilo Patron

Hi @servicenow14710 

Can you help to clarify the below concern for better understanding your use case.

Would you like to autofill the list collector or display available choice options to select within the list collector based on the selected systemInfo?

 

Cheers,

Tai Vu

Hello  @Tai Vu : I would like to display the choices for list collector based on variables i select for other variables. Thanks!