Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

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

raed1
Giga Contributor

Hello Dennis,



Thank you for your reply. That is exactly what I want. I tried to do what you suggested, however, I am still seeing the display value of the nameID instead of the u_step.



On lookup:


find_real_file.png



On selection:


find_real_file.png


have you made the u_step coulmn display "true". go to the table and mark display true for this


Hello Harsh,



I already have the NameID set as the display value. This reference field is being used in other forms as well, so I only want this to be changed across this particular form and not the other ones I have.


is it ok if you create another field on form. when ever you will select nameid based on that step will populate in another field. via dot walking.


leemey
Kilo Contributor

Dear Raed,



I am facing the same issue as you, have resolved this problem now?



Thanks,


Leemey