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.

lookup select box showing only sysid

JagjeetSingh
Kilo Sage

Hi,

I have a field "MSSQL Instance" which is referring table "cmdb_ci_db_mssql_instance" table.

And there is another field "database" where i need to populate all databases running on the particular instance name selected in "MSSQL instance" field as above.

to achieve this i am setting my second field "database" as lookup select box and referring the table "cmdb_rel_ci" and in lookup value field i am choosing "Child". The idea is to set the reference qualifier to match the parent with MSSQL instance field and then show relevant child values.

I am stuck at both the steps. In database fields i am not getting correct values. It is showing only sysIDs.

Also below is my reference qualifier which doesn't seems to work.

javascript:'parent=' + current.variables.mssql_instance

help!

Jagjeet Singh
ServiceNow Community Rising Star 2022/2023
1 ACCEPTED SOLUTION

Hi,

something like this

javascript:'parent.sys_class_name=cmdb_ci_db_mssql_instance^' + 'child.sys_class_name=cmdb_ci_db_mssql_database^' + 'parent=' + current.variables.mssql_instance;

Also in the variable attributes of the lookup select box add this

ref_qual_elements=mssql_instance

Regards
Ankur

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

View solution in original post

8 REPLIES 8

Changing that didn't work but i have used below reference qualifier to get the correct names.

javascript:'parent.sys_class_name=cmdb_ci_db_mssql_instance^'+'child.sys_class_name=cmdb_ci_db_mssql_database^'

 

Now the only thing i need in this filter is that the field "Parent" should be equal to "MSSQL Instance". I am not sure how i can add this condition here.

Jagjeet Singh
ServiceNow Community Rising Star 2022/2023

Hi,

something like this

javascript:'parent.sys_class_name=cmdb_ci_db_mssql_instance^' + 'child.sys_class_name=cmdb_ci_db_mssql_database^' + 'parent=' + current.variables.mssql_instance;

Also in the variable attributes of the lookup select box add this

ref_qual_elements=mssql_instance

Regards
Ankur

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

We did it! There is no need to set ref_qual_elements=mssql_instance because the field is on service catalog.

Jagjeet Singh
ServiceNow Community Rising Star 2022/2023

Glad to know.

Please mark appropriate response helpful as well.

Please share the final variable configuration screenshot so that it helps future readers

Regards
Ankur

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