Get display value of reference in service portal widget

asukumar
Kilo Contributor

Hi all,

I have a service portal widget with a reference field in the options schema that points to the Survey Questions table.

I want to get the display value of the question that is selected. options.question just returns the sysid of the question. I already tried options.question.getDisplayValue() and it doesn't work.

Any thoughts?

5 REPLIES 5

Chuck Tomasi
Tera Patron

Can you share the server code for your widget?


// SERVER
(function() {


data.question = options.question;


})();



// CLIENT


function() {              


var c = this;


// Display the questions from the options


$("#ques").html(c.data.question);


}


And you tried this and got a sys_id?



(function() {


data.question = options.question.getDisplayValue();


})();



What does it show in the HTML when you use:



{{c.data.question}}


The first one does not display anything, and the second one shows the sysid.