Help with reference qualifier on Catalog Item variable

Ron28
Mega Sage

I wonder if anyone can assist.

 

I have a catalog question that lists items from cmdb_ci_kubernetes_namespace table. But I want to restrict the items shown in the drop down box to just those records where the u_service column has value matching a service in another table.

 

I'm open to suggestions how to do this but the way I went was to create a script include that returns an array of service names in the other table. A client onLoad script calls the script include, putting the resulting array in a hidden question/variable (defined as one line text).


In the catalog variable I have the following type specifications:

Ron28_0-1691111322933.png


But this still returns the complete list of items in the Kubernetes Namespace table, not just those that exist in the array. I see no errors on the Javascript console. The returned array has the correct values and is stored in a text variable as stringified JSON.  

 

Any ideas on how to make this work?

 

Thanks

Ron

 

Thanks

Ron

 

 

1 ACCEPTED SOLUTION

Martin Ivanov
Giga Sage

Do your calculations in the script include. Following logic:

- In the script include make a glide record to your table, filtering based on the other table.

- Put the sys_id's in an aray and return this array

- In the reference qualifier make a simple query: sys_id IS ONE OF 'your array"

- this will try to find only the records, which have their sys_id in the array, returned by the script include.

 

hope this helps.

View solution in original post

2 REPLIES 2

Martin Ivanov
Giga Sage

Do your calculations in the script include. Following logic:

- In the script include make a glide record to your table, filtering based on the other table.

- Put the sys_id's in an aray and return this array

- In the reference qualifier make a simple query: sys_id IS ONE OF 'your array"

- this will try to find only the records, which have their sys_id in the array, returned by the script include.

 

hope this helps.

Thanks Martin, sounds like the way to go. I found documentation on advanced reference qualifiers which appears to be the solution you propose. Will let you know how I get on.

 

Thanks

Ron