How to get two columns to display in a reference field?

gjz1
Giga Expert

In my company we have departments with multiple divisions in each department.   Many departments have the same division name, for example Administration is a division in all the departments.

I created a new division table with a reference field to Departments (cmn_department) and added the division reference field to the user table (sys_user) and form.   However, I need two columns, division and department in order to differentiate which division to select.   I have added attributes to the Division reference field but I'm still not getting Division and Department as columns, only Division.   What am I missing?

On the User form:

1.   I added Division as a reference field.

2.   I selected Configure Dictionary on the division field.

3.   In Advanced View I added ref_auto_completer=AJAXTableCompleter,ref_ac_columns=u_department,ref_ac_order_by=name to Attributes.

I have tried multiple variations of the attributes, none of it seems to work.

This is in Jakarta.

10 REPLIES 10

Matthew Smith
Kilo Sage

If this is on Service Portal, then could you look at using a Lookup Select Box instead of a Reference Field? You can then use the "



Hope this helps



Matt


gjz1
Giga Expert

Andrew,



On the System Security --> Users and Groups --> Users form I have added a reference field for Division (the new table I created).   Department to Division is a 1:Many relationship which is why I need the new table.   The new Division table has a field "Department" (u_department) that is a reference to the Department table.   I need both the division and department to appear when the magnifying glass is clicked on the Division field on the form.



Ankur,



I don't believe your statement is entirely correct as I found a blog by Ben S. who did the very thing I'm trying to do with a reference field.   I have followed his example but it doesn't work.   However, I will look at the display=true settings, perhaps that is the answer.



Matt,



This is not on the Service Portal, it's on the Users form.



I'm still open to suggestions.


Apologies again if this is no use, but it will at least bump your thread if not..



Try this in the attributes section instead (replacing "department;id" with your field values): ref_auto_completer=AJAXTableCompleter,ref_ac_columns=department;id,ref_ac_columns_search=true



Then after clicking the Magnifying Glass on your new field, right click on one of the column headings and choose Configure > List Layout. I assume the Department column will already be there, but you should be able to add the Parent/Division field and remove any fields that are not required.



This is what I now see in my demo instance -



Autocomplete:


find_real_file.png


List view:


find_real_file.png


gjz1
Giga Expert

Hi Matt,



Thanks for the help, it did the trick.   I can see both columns now.   It turns out all I needed to do was configure the list layout.   All of the documentation I looked at left out that step.



Thanks again!


omdave
Kilo Contributor

Hi gjz,

I am facing the same issue,

can you please give brief how you solve this

Thanks in advance