Java script to show Department name and Department ID for the reference list in search

MIcheleWilliams
Tera Contributor

The Department variable in a catalog item is setup as a reference.  The search lists only shows the department name, how do i get the department ID to also show up with the department name in the search, 

5 REPLIES 5

pratikjagtap
Giga Guru

Hi @MIcheleWilliams ,

 

For each table there is only one display field.

You can set Department ID Display True Using Configure ->  Dictionary function.

pratikjagtap_0-1745330737395.png

 

Or you can set display true for any field from table entry in sys_db_object table.

 

You cannot set display true for two fields.

 

If my response helped, please hit the 👍Thumb Icon and accept the solution so that it benefits future readers.

 

Regards,
Pratik

 

Ankur Bawiskar
Tera Patron
Tera Patron

@MIcheleWilliams 

you should use ref_ac_columns attribute in your variable attribute and include your columns

ref_ac_columns=id

Example: I did for Server table

ref_auto_completer=AJAXTableCompleter,ref_ac_columns=category;serial_number,ref_ac_columns_search=true,ref_ac_order_by=name

Variable attributes sections

AnkurBawiskar_0-1745330929906.png

 

Output: I have added category and serial_number as extra fields to be shown along with name

AnkurBawiskar_1-1745330929907.png

 

 

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

@MIcheleWilliams 

Hope you are doing good.

Did my reply answer your question?

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

@MIcheleWilliams 

Hope you are doing good.

Did my reply answer your question?

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