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.

getDisplayValue() is not working in UI pages in scoped applications

Bhagya Lakshmi
Mega Guru

HI Team,

I created a ui page in scoped application for practice purpose. I want to print incident details for particular incident. Below is the code I have written in the ui page.

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
	
<g:evaluate var="jvar_inc" object="true">
		var inc = new GlideRecord('incident');
		inc.get('ac8f13221b8640103487dd3cdc4bcb7a');
		inc;
</g:evaluate>
	
${jvar_inc.getDisplayValue('caller_id')}
	
</j:jelly>

When I m using jvar_inc.getValue(), output showing the sys id of the caller. But when I am using the jvar_inc.getDisplayValue(), UI page showing empty output. Is getDisplayValue() will work in scoped applications?

Can you please provide the alternate solution?

 

Thanks in advance,

Bhagya Lakshmi.

1 ACCEPTED SOLUTION

here is your updated script. 

 

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">

<g:evaluate object="true">
var inc = new GlideRecord('incident');
inc.get('ac8f13221b8640103487dd3cdc4bcb7a');
inc;
</g:evaluate>

${inc.caller_id.getDisplayValue()}
	${inc.number.getDisplayValue()}

</j:jelly>

 

If my answer helped you, kindly mark it as correct and helpful.

View solution in original post

8 REPLIES 8

Harsh Vardhan
Giga Patron

it will work. 

 

try now. 

 

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">

<g:evaluate var="jvar_inc" object="true">
var inc = new GlideRecord('incident');
inc.get('9a38b7092f030410f68d5ff62799b6d3');
inc.caller_id.getDisplayValue()
</g:evaluate>

${jvar_inc}

</j:jelly>

Thanks for the response. I want to print number, caller id, short description as well. How can I print those details?

kindly have a look on below thread. let me know if you have any further question on it ?

 

 

https://community.servicenow.com/community?id=community_question&sys_id=805507addbd8dbc01dcaf3231f96...

here is your updated script. 

 

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">

<g:evaluate object="true">
var inc = new GlideRecord('incident');
inc.get('ac8f13221b8640103487dd3cdc4bcb7a');
inc;
</g:evaluate>

${inc.caller_id.getDisplayValue()}
	${inc.number.getDisplayValue()}

</j:jelly>

 

If my answer helped you, kindly mark it as correct and helpful.