How to Display Reference Field as "Last Name, First Name" Only in a Record Producer and Workspace?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Requirement: Display User Name as "Last Name, First Name" In the Record Producer, there is a Reference variable that references the User [sys_user] table. Currently, the user names are displayed in the default format. Requirement: The reference field should display user names in the format Last Name, First Name (e.g., Smith, John) while searching and selecting users in the Record Producer. After the request is submitted from the Service Portal, the selected user should continue to be displayed in the same format (Last Name, First Name) in the Workspace view. The display format should remain consistent across the Record Producer, submitted request, and Workspace. This change should apply only to this reference field and should not impact the display format of user names elsewhere in the ServiceNow instance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
out of the box the name field stores First Name + Last Name and name field is Display=true on sys_user
The only option for you is
1) create a text type variable and set it with Last Name + First Name onChange of user variable and make that variable readonly
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Just following up to see whether my suggested solution worked for you.
If you're still facing any issues, I'd be happy to help further.
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello @manthenamah,
If this is a plain Reference variable on the Record Producer pointing straight at sys_user, and you want a config-level fix rather than a custom Service Portal typeahead widget. With that assumption, here's what's actually possible and where the hard wall is.
The text a reference field shows comes from the display value field on the target table's dictionary entry, the "display" checkbox set true on exactly one sys_dictionary record per table. For sys_user that's the calculated Name field, and it's table-wide: flip it to "Last Name, First Name" and every reference field, list, and notification anywhere in the instance that points at sys_user changes with it. There's no per-field override of that setting, so touching it directly breaks the "only this one field" part of your requirement.
What you can do without a global change is split this into search behavior and stored/rendered behavior:
- Typeahead in the Record Producer: on the variable's Attributes, set ref_auto_completer to AJAXTableCompleter, then add ref_ac_display_value=false, ref_ac_columns=last_name;first_name, and ref_ac_columns_search=true. This drops the default Name column from the dropdown and shows last_name then first_name as separate columns instead, and lets people search by either. It won't render as a single "Smith, John" string with a literal comma, ref_ac_columns just lists columns, it doesn't concatenate them, but it gets you last-name-first ordering natively with no dictionary change involved.
- What sticks after selection, on the submitted request, and in Workspace: once a value is picked, the reference field itself always renders through the table's real display value, so it reverts to the default format no matter what the typeahead showed. To keep "Last Name, First Name" visible everywhere downstream without touching sys_user, add a separate read-only string field, for example u_requested_for_display, on the target table. Populate it in a before insert/update Business Rule as last_name concatenated with ", " and first_name off the reference field, and put that string field on the Workspace form and list layout in place of the raw reference field. The reference field itself stays underneath, untouched, for reporting and reference integrity.
That keeps the change scoped to one variable and one new field. Nothing about sys_user's global display value or any other reference-to-sys_user field elsewhere in the instance gets touched.
Thank you,
Vikram Karety
Octigo Solutions INC
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago - last edited 2 weeks ago
Hi @manthenamah
You can try this workaround,
- Navigate to your Record Producer and open the specific Reference Variable.
- Scroll to the Default Value or Variable Attributes tab (depending on your layout, you may need to click Advanced View )
- In the Attributes field, append or paste the following string exactly:
ref_auto_completer=AJAXTableCompleter,ref_ac_display_value=false,ref_ac_columns=last_name;first_name,ref_ac_columns_search=true
Check if it works for you.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti