Search on Two Columns with Reference Field Variables

ctsmith
Mega Sage

I have a custom table that is called in two reference field variables.   One of the variables need to search on column A from the table, and the other on column B.   I've seen some discussion on this, but none of them seem to have a solid solution that isn't too invasive to the table.   Since you can only set one display value to true, I can't get this to work. Any thoughts?

Thanks,


Chris

13 REPLIES 13

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Chris,



You are correct. You can only set one display value to true.


The only option here is that you can define other columns in the search drop down with the help of attribute. More info here.


Auto-Complete for Reference Fields - ServiceNow Wiki



Please let me know if you have any questions.


Abhinay Erra
Giga Sage

You can search on different columns by setting "ref_ac_columns_search" attribute to true. The following example I can search on email field of the user by suing this in the attributes field


ref_auto_completer=AJAXTableCompleter,ref_ac_columns=email,ref_ac_columns_search=true


find_real_file.png



Go thru section 8 in this link


Auto-Complete for Reference Fields - ServiceNow Wiki


Yeah, I saw that earlier, but didn't have much luck.   Let me give it another try.   where it says email in your example above, if it's two columns, you separate them by commas as well, correct?



So, like:



ref_auto_completer=AJAXTableCompleter,ref_ac_columns=email,phone,last_name,ref_ac_columns_search=true


Nope, you separate them semicolon.Try this


ref_auto_completer=AJAXTableCompleter,ref_ac_columns=email;phone;last_name,ref_ac_columns_search=true