Displaying a Non-Display Field in Reference Field

markmmiller09
Kilo Expert

I am wondering if it is possible to do the following:

 

A,B, and C represent columns in table 1 where A is the Display field.

ABC

 

X,Y, and Z represent columns in table 2 where X is the Display field.

XYZ

 

In a form view for table 2, is it possible to have a reference field which references a column other than the Display field, say C, from table 1. So a user can type the data related to table 1, column C and store that in the reference field on the form for table 2?

Changing the Display field for table 1 would effect other forms, therefore, I cannot take that approach.

 

Any ideas?

13 REPLIES 13

I revised my opinion. I think this could be done with an onload client script that simply replaces the text contents of the choice list with your desired field values.



The following line would change one option:


jQuery('#field option:contains("oldValue")').text('newValue');



You could put this into a loop for your table:



var gr = new GlideRecord('yourTable');


while (gr.next()) {


  jQuery('#field option:contains("' + gr.getDisplayValue() + '")').text("'gr.column_c'");


}



Obviously you would need to customize this for your table and field names.


This will provide both the display value and the field selected by ref_ac_columns.

Do you have any other method to display only non display field?? 

Michael Ritchie
ServiceNow Employee
ServiceNow Employee

You may be able to accomplish this with a dictionary override:


http://wiki.servicenow.com/index.php?title=Dictionary_Overrides



This works for tables that are extended though.   Example from the Wiki: the Story [rm_story] table uses the short description as the display value in reference fields instead of the number, as defined in the Task [task] table.


Unfortunately, it isn't an extended table.