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

Did you create in global application scope or scoped application?

scoped app . i tested in HR scope. 

 

find_real_file.png

result

find_real_file.png

I tried with your solution, it is working as expected. By using jvar_inc also we can get the output. It is working fine in global scope but it is not working in scoped application. Is any specific reason to that?

i tested in hr scope and its working for me. i am able to fetch it. 

are you trying it on personal instance ?

if yes i can quickly look-into this. drop me the personal instance details on below email.

 

hvrdhn88@gmail.com