UI page to display record details

Bharath38
Tera Guru

I'm working on a requirement to create a UI page that takes catalog item as input and display info of catalog item from Maintain item table.

 

Also a way to call this UI page from Catalog item itself, so UI page should take catalog item id as input when called.

 

Below is my html script but this is direct display , I'm able to add input variable as well but not get info when changed.

 

 

Any inputs ?

 

 

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
	<div style="font-weight:bold;font-size:20px;; padding-left:500px">Catalog Item details</div>
<g:evaluate jelly="true">
		var nameSCI='';
		var sd='';
		var gr = new GlideRecord('sc_cat_item');
		gr.addQuery('sys_id','ff6933fedbd4a45014670010ba9619bf');
		gr.query();	
		if(gr.next()){
		nameSCI = gr.name.toString();
		sd = gr.short_description;
		}	
</g:evaluate>
<table class="table table-bordered">
<tr style="background-color:#428BCA; color:#FFFFFF;">	
	<td>Title</td>
	<td>Value</td>
</tr>
<tr>
<td style="font-weight:bold">Name</td>
<td>${nameSCI}</td>
</tr>
<tr>
<td style="font-weight:bold">Short Description</td>
<td>${sd}</td>
</tr>
</table>
</j:jelly>

 

 

Bharath38_1-1679005228650.png

 

7 REPLIES 7

@Bharath38 

Can you explain your business requirement here?

 

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

We would like to display additional details for a catalog item, we don't want to display all on catalog item page so I thought redirecting user to a UI page from catalog item page hyperlink and display would be better.

Vedika29
Tera Contributor

Vedika29_0-1724348120259.png

<div id="fields" style="display: none; margin-bottom: 20px;">
                    <div style="margin-bottom: 15px;">
                        <label for="contact" style="display: block; margin-bottom: 5px;">Contact:</label>
                        <!-- Replace input with a reference field -->
                        <!-- <g:ui_reference label="Name" name="contact" table="sys_user" field="name"  style="width: 100%; max-width: 300px;"/>  original -->
                         <g:evaluate var="jvar_contact" expression="RP.getParameterValue(sysparm_contact).contact">
                 
                        <!-- <g:evaluate var="jvar_choices" object="true"> -->
                        var nameSCI='';
            gr = new GlideRecord('sn_customerservice_case');

        gr.addEncodedQuery(''sys_id=' + taskSysId');
        gr._query();
        if (gr.next()){
        nameSCI = gr.contact.toString();
        }
    </g:evaluate>
    <g:ui_reference name="Name" id="jvar_contact" value="${nameSCI}" displayvalue="${jvar_contact}" table="sys_user" completer="AJAXTableCompleter" ng-model="Name"/>
    <p>${jvar_contact}</p>  I wanted to populate the contact value from case form in the ui page but currently I am getting the null value in contact field on ui page which is of type reference. Can anyone suggest the steps to be followed to achieve it.