Filter a list collector based on others variables on PORTAL

Nico12
Mega Sage

Hi,

 

We got a catalog item with 3 fields.

 

City(reference), floor(select box) and printer(list cllector).

Floor display when City A is chosen

Floor got 3 values (2, 3 or 4)

printer field got a default query that return 3 printers

 

How it works :

 

City A + 2 or 4 floor should set a query 1 for printer field

City A + 3 floor should set a query 2 for printer field

if user change city, printer should return to defult query.

 

is there a way to change query of a list collector on PORTAL view ?

 

regards,

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron

@Nico12 

it's not possible to set the filter in list collector in portal, it can be done in native

you can use advanced ref qualifier on list collector like this so that it shows filtered records to user based on other 2 variables

Note -> ensure you give correct variable name and value to compare etc including choice value

-> ensure you add in variable attributes this with correct variable names

ref_qual_elements=city,floor

javascript: var query;
var city = current.variables.city.name;
var floor = current.variables.floor;
i(city == 'City A' && (floor == '2' || floor == '4'))
query = 'query1';
else if(city == 'City A' && floor == '3')
query = 'query2';
else
query = 'defaultQuery';
query;

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

1 REPLY 1

Ankur Bawiskar
Tera Patron

@Nico12 

it's not possible to set the filter in list collector in portal, it can be done in native

you can use advanced ref qualifier on list collector like this so that it shows filtered records to user based on other 2 variables

Note -> ensure you give correct variable name and value to compare etc including choice value

-> ensure you add in variable attributes this with correct variable names

ref_qual_elements=city,floor

javascript: var query;
var city = current.variables.city.name;
var floor = current.variables.floor;
i(city == 'City A' && (floor == '2' || floor == '4'))
query = 'query1';
else if(city == 'City A' && floor == '3')
query = 'query2';
else
query = 'defaultQuery';
query;

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader