Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Filter Reference field based on related item

yokeshkumar kj
Tera Contributor

Hi Community,

I need help filtering a reference field in a catalog item.
 1. Scenario:
 • I have created a catalog variable called MID Server Cluster, which references the MID Server Cluster table (ecc_agent_cluster).
 • This table is related to the MID Server Cluster Member M2M table (ecc_agent_cluster_member_m2m), which links clusters to MID Servers.
 2. Requirement:
 • I want the reference variable to show only clusters (ecc_agent_cluster) that are connected to MID Servers in the related table (ecc_agent_cluster_member_m2m).

Please help me on this. Thanks!

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@yokeshkumar kj 

can you please explain which variable should be filtered on which variable?

ecc_agent_cluster_member_m2m already has a field which refers to table "ecc_agent_cluster"

So I believe you want to show MID Server Cluster based on Mid Server cluster?

If yes then use this in advanced ref qualifier

javascript: 'current.cluster=' +current.variables.variableName; // give here the variableName which refers to ecc_agent_cluster  

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

Hi @Ankur Bawiskar 

I have created a reference field  in a catalog item referencing the MID server Cluster(ecc_agent_cluster. it is showing all the cluster records.

yokeshkumarkj_0-1733493136635.png

I want to show only records that are connected to a MID Server. some clusters do not have any connections, so I want to display inly records that are associated  with a MID Server.

connection screenshot:

yokeshkumarkj_1-1733493436943.png

Please help me with this. Thanks!