How to Display Name + UserID eg. Abel Tutor(abel.tutor) in this format in reference field ?

contactvwak
Tera Contributor
 
1 ACCEPTED SOLUTION

Chaitanya ILCR
Mega Patron

HI @contactvwak ,

 

you have update the dictionary (name)

add the script at the end 

var firstName = current.getValue('first_name');
var lastName = current.getValue('last_name');
var userName = current.getValue('user_name');

(firstName ? firstName + ' ' : '') + (lastName ? lastName + ' ' : '') + (userName ? '(' + userName + ')' : '');

ChaitanyaILCR_0-1752732195655.png

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

 

View solution in original post

5 REPLIES 5

Pranesh072
Mega Sage
Mega Sage

It is not possible to use 2 different fields on the reference field. 

 

If is it really needed, you can create a new field on sys_user table and update that field with Display Name + UserID. Use new field as display field. Not Recommended.

 

You can also use the showfieldmsg to display other field in info message below first field.

Shraddha Kadam
Mega Sage

Hello @contactvwak ,

 

This is not possible. However, if you want to populate UserID on the reference field then make Display Value true on the User ID field.

If my response was helpful, please mark it as correct and helpful.
Thank you.

Chaitanya ILCR
Mega Patron

HI @contactvwak ,

 

you have update the dictionary (name)

add the script at the end 

var firstName = current.getValue('first_name');
var lastName = current.getValue('last_name');
var userName = current.getValue('user_name');

(firstName ? firstName + ' ' : '') + (lastName ? lastName + ' ' : '') + (userName ? '(' + userName + ')' : '');

ChaitanyaILCR_0-1752732195655.png

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

 

Ankur Bawiskar
Tera Patron
Tera Patron

@contactvwak 

please share some screenshots where is this required

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