Get display value of reference in service portal widget
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2017 08:14 AM
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?
- Labels:
-
Service Portal Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2017 08:19 AM
Can you share the server code for your widget?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2017 08:22 AM
// SERVER
(function() {
data.question = options.question;
})();
// CLIENT
function() {
var c = this;
// Display the questions from the options
$("#ques").html(c.data.question);
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2017 08:29 AM
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}}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2017 08:33 AM
The first one does not display anything, and the second one shows the sysid.