Auto-Complete Reference Field Search for Multiple Fields

kesha
Kilo Contributor

I created a Service Catalog Item request and had a question regarding one of the requirements. The UI Macro associated to this request functions as required, however I need to have two values (Vendor Number and Alternate Vendor Number which are custom fields we created for the core_company table) auto-populate when the user is searching for the Company Name (as pictured in the screenshot below). The only way I was able to make this function was by adding an attribute to the core_company dictionary entry, but this is not our ideal option. Any feedback on how to implement this into my UI Macro would be greatly appreciated. I attached a copy of the UI Macro.

Attribute:

ref_ac_columns_search=true,ref_ac_order_by=name,ref_ac_columns=u_vendor_number;u_vendor_number_alternate,ref_auto_completer=AJAXTableCompleter

find_real_file.png

1 ACCEPTED SOLUTION

Gurpreet07
Mega Sage

ui_reference is a ui macro having support for attributes .. completer,columns.



find_real_file.png


View solution in original post

15 REPLIES 15

chirag_bagdai
ServiceNow Employee
ServiceNow Employee

Hi Kesha,



Please visit below link :


Auto-Complete for Reference Fields - ServiceNow Wiki



However, I have tried below example :



Screen Shot 2017-06-24 at 3.12.37 AM.png


1. Goto dictionary entry and update "Attribute" :


all_tables.text_index_translations=true,ref_ac_columns_search=true,ref_ac_order_by=name,ref_ac_columns=u_vendor_number;u_alternate_vendor_number,ref_auto_completer=AJAXTableCompleter


Screen Shot 2017-06-24 at 3.10.54 AM.png



Please note that you need to update "ref_ac_columns=u_vendor_number;u_alternate_vendor_number," with your field name.



Also, this change will apply to table level.


I was looking to go with the ui macro logic, but thanks for the response Chirag.


Hi,

 

I am trying to get this right, but I am not able to.

 

There is a reference field on Incident form called Business Service which is referencing to cmdb_ci_service class.

 

I am using this attribute to show and search these columns : NAME, u_acronym

 

all_tables.text_index_translations=true,ref_ac_columns_search=true,ref_ac_order_by=name,ref_ac_columns=name;u_acronym,ref_auto_completer=AJAXTableCompleter

 

But I am not able to see the column u_acronym to search for and auto-complete is not showing this column as well. 

 

u_acronym is the custom field created on business service class and is of type String.

Attaching screenshots of output and attribute