Reference field display value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I have to create a new variable 'Application AIR ID' referencing to 'u_air_attributes' table & the 'Application AIR ID' should display the Application ID's.
But the problem is when I am creating the reference variable it displays the 'Application Name' as the display value is true for it in 'u_air_attributes' table. I cannot change the display true as the table is owned by other team & also it will affect globally.
How can I achieve this I tried using the variable attribute -
ref_auto_completer=AJAXTableCompleter,ref_ac_columns=u_application_id,ref_ac_columns_search=true,ref_ac_display_value=false
But this shows both the Application Name & Application ID and also when I select any option it shows the application name.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @SanikaK,
If the requirement is to display only the Application AIR ID without changing the Display field on the u_air_attributes table, one supported approach is to use a Lookup Select Box variable instead of a Reference variable.
Configuration:
Type = Lookup Select Box
Lookup source = Table
Lookup from table = u_air_attributes
Lookup value field = u_application_id
This displays:
directly in the catalog item and does not depend on the table's Display field (Application Name).
If a true Reference variable is required, ServiceNow will always display the referenced table's Display Field after selection. In that case, attributes such as
ref_auto_completer=AJAXTableCompleter,
ref_ac_columns=u_application_id,
ref_ac_columns_search=true
can help users search by AIR ID, but the selected value will still display the table's Display Field.
So for displaying only AIR IDs without changing the table Display field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @SanikaK
For your requirement ,if you need it no code, then instead of reference type variable , use Lookup select box variable.
- Create variable Application AIR ID.
- Select the Type Lookup Select Box.
- Go to the Type Specifications tab and configure it as follows:
- Lookup from table: u_air_attributes
- Lookup value field: sys_id
- Lookup label field(s): u_application_id
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello @SanikaK ,
You can use a client script to visually overwrite what text is shown in the field right after a user selects a record.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || !newValue) {
return;
}
var refRecord = g_form.getReferenceRecord(control);
control.setDisplayValue(refRecord.u_application_id);
}
If my response helped mark as helpful and accept the solution.