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

Reference variable referencing a different column on a table?

Abbottronix
Tera Guru

Is there a way to get a reference variable on a catalog item to reference a difference column on a table?

I want a reference variable that lists all the email addresses on the user table and allows you to select them. 

The way I have it set up now has the email addresses listed next to the names, but when selected it still just shows the name in the select box, and not the email.

 

Screenshot 2024-03-28 151531.png

1 ACCEPTED SOLUTION

Nick Parsons
Mega Sage

As far as I'm aware, you can't change the display value for a singular reference field. You can change the display value for all fields that reference the sys_user table, which would be done by modifying which column on the sys_user table has Display = True set, but you most likely don't want to do that.

 

I would suggest that you add a new readonly variable next to or beneath your reference field which displays the selected user's email. On the new variable, you can use the "Auto-populate" tab with the following options:

Dependent Question = Your user reference variable/question

Reference field = User [sys_user] (autopopulated)

Dot walk path = Email   

 

This will display the select user's email in the new variable that you create.

View solution in original post

3 REPLIES 3

Dhananjay Pawar
Kilo Sage

Hi,

You need to go to the user table and for email field you need to set the display as true but this will be global impact. It will impact everywhere in the instance.

 

https://InstanceName.service-now.com/sys_db_object.do?sys_id=sys_user&sysparm_refkey=name

 

In above link change the instance name. and under column related list search for email and set the display as true(check attached screenshot for more clarity).

Thanks,

Dhananjay.

ayaanrizvi
ServiceNow Employee
ServiceNow Employee

Please refer to the below community article - there are a couple of solutions that might help with your query.

https://www.servicenow.com/community/developer-forum/email-address-in-reference-field/m-p/1633822/hi...

Additionally you could always set the display field value to true at the dictionary level of the sys_user table to true as per your business requirements. Please note that this will affect the value of reference field system-wide.

Nick Parsons
Mega Sage

As far as I'm aware, you can't change the display value for a singular reference field. You can change the display value for all fields that reference the sys_user table, which would be done by modifying which column on the sys_user table has Display = True set, but you most likely don't want to do that.

 

I would suggest that you add a new readonly variable next to or beneath your reference field which displays the selected user's email. On the new variable, you can use the "Auto-populate" tab with the following options:

Dependent Question = Your user reference variable/question

Reference field = User [sys_user] (autopopulated)

Dot walk path = Email   

 

This will display the select user's email in the new variable that you create.