How Can I Populate a List Collector Field Based on Values From Another List Collector Field?

cwolfe01
Giga Guru

I'm making some improvements to a form, and it has two list collector fields for "Requested For" & Asset Tag(s) respectively. I want the Asset Tag(s) field to show all the assets for any values in the Requested For field.

 

Currently, the Asset Tag(s) field is only showing the assets for one person in the Requested For field. If I try to add more people to the Requested For field, their assets aren't showing up in Asset Tag(s). I'll include the reference qualifier and variable attributes below.

 

Reference Qualifier:

javascript:
var query = "sys_class_name=cmdb_ci_computer^operational_status!=6^owned_by="+current.variables.requested_for;
query;

 Variable Attributes:

ref_auto_completer=AJAXTableCompleter,ref_ac_columns=asset;owned_by,ref_ac_columns_search=true

 

 Would I need to change my script to get the desired result, or would I need to employ another method?

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@cwolfe01 

you should do 2 things

1) advanced ref qualifier as mentioned by peter

you should use IN so that it works for multiple users

owned_byIN

2) variable attributes add this

ref_auto_completer=AJAXTableCompleter,ref_ac_columns=asset;owned_by,ref_ac_columns_search=true,ref_qual_elements=requested_for

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

View solution in original post

2 REPLIES 2

Peter Bodelier
Giga Sage

Hi @cwolfe01 

 

Try this as reference qualifier:

javascript:
var query = "sys_class_name=cmdb_ci_computer^operational_status!=6^owned_by.sys_idIN"+current.variables.requested_for;
query;

Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

Ankur Bawiskar
Tera Patron
Tera Patron

@cwolfe01 

you should do 2 things

1) advanced ref qualifier as mentioned by peter

you should use IN so that it works for multiple users

owned_byIN

2) variable attributes add this

ref_auto_completer=AJAXTableCompleter,ref_ac_columns=asset;owned_by,ref_ac_columns_search=true,ref_qual_elements=requested_for

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