Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

How to allow a Reference Field to search by both Number and ID from the referenced table?

SpanduS
Mega Contributor

Hi everyone,

I have a requirement where a field in my table is referencing another table (Reference field).

In the referenced table, there are two fields:

  • Number

  • ID

My requirement is:

  • If the user types or searches using Number, it should display/select the record using the Number.

  • If the user types ID, it should also find and display the same record using the ID.

Currently the reference field only searches based on the display value. I need it to allow searching by both Number and ID, and show the corresponding record when either value is entered.

Has anyone implemented something similar?
Should this be handled using reference qualifier, dictionary attribute, or script include / autocomplete configuration?

 

Note :  I tried with (attribute in Attributes field) ref_ac_columns=id,number ut not working as expected and I can able to see only number not Id's.

 

Any guidance would be appreciated. Thanks!

Spandus

2 REPLIES 2

Dr Atul G- LNG
Tera Patron

Did you try using ref_ac_columns=id,number separately?
If possible, please share a screenshot.

*************************************************************************************************************
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]

****************************************************************************************************************

Ankur Bawiskar
Tera Patron

@SpanduS 

you need to give the ref_ac_columns attributes for that and give the additional fields

Do give the other attribute as well so that the search happens with id and number

ref_auto_completer=AJAXTableCompleter,ref_ac_columns=id;number,ref_ac_columns_search=true

💡 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  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader