Reference qualifier for list collector

Rosy14
Tera Guru

Hi

I have 2 fields of list collector type. Where 2nd list show records based on 1st list. Like if list1 contains ABC in account name list2 will show records where company contains ABC. If list1 contains XYZ then list2 XYZ.. If both then both like that.how to do in reference qualifier.

Tried a lot. Plz help

3 REPLIES 3

AshishKM
Kilo Patron
Kilo Patron

Hi @Rosy14 ,

Please refer below thread for similar query

 

https://www.servicenow.com/community/developer-forum/populate-2-list-collector-variables-depending-o...

 

-Thanks,

AshishKMishra


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

it is from lookup. In my case both are list collector.

Regards,

R

Amit Gujarathi
Giga Sage
Giga Sage

Hi @Rosy14 ,
I trust you are doing great.
The script will look at the current value(s) in list1 and use them to filter the options in list2. Here's an example script:

 

(function() {
    var list1Values = current.getValue('list1'); // Replace 'list1' with the actual field name
    if (list1Values) {
        var list1Array = list1Values.split(',');
        var query = '';
        list1Array.forEach(function(value, index) {
            if (index > 0) {
                query += 'OR';
            }
            query += 'companyLIKE' + value.trim(); // Assuming 'company' is the field you want to filter on in list2's referenced table
        });
        return query;
    }
})();

Was this answer helpful?


Please consider marking it correct or helpful.


Your feedback helps us improve!


Thank you!


Regards,


Amit Gujrathi