The CreatorCon Call for Content is officially open! Get started here.

Display User Email ID Instead of Name in Referenced List-Type Field

kuntasaiviv
Giga Contributor

Hi,
I'm trying to achieve the below requirement.

Requirement: In a list-type field that references the user table, display the user's Email ID instead of the user's Name after selecting a user record.

kuntasaiviv_1-1757955525203.png

can anyone help me with this?

 

5 REPLIES 5

M Iftikhar
Giga Sage

Hi @kuntasaiviv

 

To achieve this, you cannot directly change the final display value for a single list collector field after a user is selected, because this is controlled globally by the sys_user table's display value (which is the "Name" field). Modifying the table's display value to "Email" would undesirably change it for every user reference field across the entire platform. Out-of-the-box functionality does not support showing both name and email combined in the pill after selection.

 

However, you can significantly improve the user experience during selection by configuring attributes on your list collector variable. By using the ref_ac_columns attribute, you can display the user's email alongside their name in the auto-complete dropdown list as the user types. This ensures the user can correctly identify the person by their email before selecting them, even though only the name will appear in the field once selected. To implement this, navigate to your list collector variable's definition, and in the "Variable Attributes" field, add ref_ac_columns=email. This will add the email column to the selection dropdown.

 

Hope this helps!

 

Thanks & Regards,
Muhammad Iftikhar
If my response helped, please mark it as the accepted solution and helpful so others can benefit as well.

Ankur Bawiskar
Tera Patron
Tera Patron

@kuntasaiviv 

2 Options

1) Mark email field on sys_user as Display=true and it will start showing Email field.

Note: This will be global change and will impact everyplace where field/variable refers sys_user

OR

2) add another multi-line string field (length more than 255) and then use onChange client script and populate email addresses of the users selected in that string field (Recommended way)

for script check below link and enhance it

Populate Email Addresses of users selected in List Collector variable to Multi Line Text Variable 

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

@kuntasaiviv 

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

RaghavSh
Kilo Patron

@kuntasaiviv For this you will have to change the display value of user table from

name to email , which is not recommended as it will affect the entire instance.

 

So in short, this is the behaviour of list collector and reference fields which should not be changed.


Raghav
MVP 2023
LinkedIn