Store value other than the display value

raed1
Giga Contributor

Hey guys,

Is there a way to display and store the value on a reference field other than the display value of the table it is referencing? I am currently dynamically trying to populate the Step field, based on the Job Title selection, however I want the 'Step' reference field to display the u_step field on the table instead of the name id (which is set as the display field).

This what I have on the form:

find_real_file.png

This is my script include that I am calling as reference qualifier on the step dictionary item:

var ChangeStep = Class.create();

ChangeStep.prototype = {

      initialize: function() {

      },

  changeOptions : function() {

            var stepList = ' ';

            var jt = current.u_job_title;

            var sl = new GlideRecord('profiles');

            sl.addQuery('u_udc','position');

            if(jt) {

                      sl.addQuery('uc_code',jt.u_it_code);

            }

            sl.query();

            while(sl.next()) {

                      if (stepList.length > 0) {

                                stepList += (',' + sl.u_step);

                      }

                      else {

                                stepList = sl.u_step;

                      }

            },

  return 'u_stepIN' + stepList;

  },

        type: 'ChangeStep'

};

Thanks,

Raed

13 REPLIES 13

Is there any solution for this? I am also facing the same issue.



Thanks


Hiran


Are you looking to have different to be show in reference field other than what is set for display value? If yes then that's not possible. In a table there can be only one column set as display and when you reference that table only display value true can be shown. but you can achieve it by setting the ref_ac_display_value attribute to false.



https://docs.servicenow.com/bundle/geneva-servicenow-platform/page/administer/field_administration/t...



Please check below link if that helps.


Yes, in reference field i want to display other field value than the "display field" .


I have already checked this link. As per this link it changes the default view on global level eg - wherever i will use sys_user table as reference it will by default display that column.



But i want to just display "Email ID" as default in one place. In other places it should display "Name" as OOB.



Thanks


Hiran


using below you can list the email id in search but at the end it will only be the displayvalue "name" be shown in the field.



ref_auto_completer=AJAXTableCompleter,ref_ac_columns=email,ref_ac_columns_search=true,ref_ac_display_value=false



find_real_file.png