How do we add reference qualifier for list collector in catalog item.

shalinihorak
Tera Contributor

I have a list collector field in catalog item which is referencing the asset table called u_st_hsm. I have to populate fields on the list collector  based on another variable in the catalog item called location_2 . I also need to add another filter for the list collector to display values which have install_status.value!=3 or Install_status is not In Maintenance. How can we add reference qualifier for this.

 

the current reference qualifier is

javascript:'location.name='+current.variables.location_2;

 

variables attributes is

ref_auto_completer=AJAXTableCompleter,ref_ac_columns=name;location,ref_ac_order_by=name,ref_ac_columns_search=true

I need to add filter on the list collector for asset table so that they do not display values with Install_status which have value 3 or In maintenance.

 

 

9 REPLIES 9

Brad Bowman
Kilo Patron
Kilo Patron

If your current reference qualifier is working for the first part, the new one would look more like this, assuming your instance has the out of box value of 3 for 'In Maintenance':

javascript:'location.name=' + current.variables.location_2 + '^install_status!=3';

If your location_2 variable is a reference type, then you would just use 'location=' as reference variables store a sys_id and location is a reference field on the asset table so that would match the value stored in location_2.

 

Since this is a List Collector variable, your Variable Attributes aren't appropriate or relevant as they only apply to Reference type variables and fields.  You do need one new attribute so that the list filter updates when the value of the location_2 variable changes:

ref_qual_elements=location_2

 

palanikumar
Mega Sage

Hi,

Try the below reference qualifier

javascript:'location.name='+current.variables.location_2+'^install_status!=3';

Thank you,
Palani

kaushal_snow
Mega Sage

Hi @shalinihorak ,

 

1. Enter the following into the Reference qualifier field of the List Collector variable....

javascript: 'location=' + current.variables.location_2 + '^install_status.value!=3^install_status.value!=In maintenance'

 

Why this works:

 

Filters assets by location_2 using the sys_id (since location is a reference type). Excludes assets with install_status.value = 3. Also excludes assets whose install_status.value label is "In maintenance". Ensures only relevant assets appear in the list collector.

 

2. Catalog Variable Attribute

 

Under Variable attributes for your List Collector, add.....

ref_qual_elements=location_2


This attribute ensures that the platform includes the latest value of location_2 when calculating the reference qualifier so the List Collector dynamically updates whenever location_2 changes....

 

If you found my response helpful, please mark it as ‘Accept as Solution’ and ‘Helpful’. This helps other community members find the right answer more easily and supports the community.

 

Thanks and Regards,
Kaushal Kumar Jha - ServiceNow Consultant - Lets connect on Linkedin: https://www.linkedin.com/in/kaushalkrjha/

Ankur Bawiskar
Tera Patron
Tera Patron

@shalinihorak 

variable location_2 is of what type?

response from @Brad Bowman  should work provided your config is correct.

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

It is a selectbox with 2 location choices.