How to show “Name – Site Code” in reference autocomplete?

LokeshwarRV
Tera Contributor

I have a reference field where autocomplete search works using:

ref_auto_completer=AJAXReferenceCompleter,
ref_ac_columns=name;u_site_code,
ref_ac_columns_search=true

I can search by name and site code, but the autocomplete dropdown still shows only the name (display value).

Is there any supported way to display Name – Site Code together in the autocomplete results, or does autocomplete only show the display value?

Thanks!

2 ACCEPTED SOLUTIONS

Ankur Bawiskar
Tera Patron

@LokeshwarRV 

it should work fine as mentioned by @Brad Bowman  

is the field name correct?

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

View solution in original post

Does your Attributes related list on the Dictionary Entry of the reference field reflect the same attributes and values, similar to this from my example?

BradBowman_0-1769003012060.png

Have you confirmed that 'u_site_code' is the exactly correct Column name and that this field exists on the referenced table?  In my example this is first_name and last_name on the sys_user table since caller_id references this table:

BradBowman_1-1769003187597.png

 

 

 

View solution in original post

4 REPLIES 4

Brad Bowman
Kilo Patron

The display column will always be shown in the search results, so you don't really need to include it in the ref_ac_columns attribute.  Adding the site code field here should show the field in the search results, provided the field name is exactly correct.  To be clear, this is the list of records that match the search criteria, which is different than the display value of the selected record, which will always only show the display field.

 

For example, if I add ref_ac_columns=first_name;last_name to the attributes on the out of box caller_id field on the incident table, it will look like this:

BradBowman_0-1768942562462.png

but once I select a record, it just shows the display field

BradBowman_1-1768942604722.png

 

Hi @Brad Bowman  
i have used the same code but unable to get the

LokeshwarRV_0-1768990014326.png

ref_auto_completer=AJAXReferenceCompleter,
ref_ac_columns=u_site_code,
ref_ac_columns_search=true,

Does your Attributes related list on the Dictionary Entry of the reference field reflect the same attributes and values, similar to this from my example?

BradBowman_0-1769003012060.png

Have you confirmed that 'u_site_code' is the exactly correct Column name and that this field exists on the referenced table?  In my example this is first_name and last_name on the sys_user table since caller_id references this table:

BradBowman_1-1769003187597.png

 

 

 

Ankur Bawiskar
Tera Patron

@LokeshwarRV 

it should work fine as mentioned by @Brad Bowman  

is the field name correct?

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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