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.

How to get current form values in UI macro jelly script

madhuabbaraju
Kilo Contributor

Hi All,

I have created a formatter and UI macro. And formatter is added to incident form. Now i want to display current incident fields to the formatter.

Created UI macro with below script but it is not showing any values. Please help me.

 

<?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="jvar_gr">
var sys_id = current.getValue('sys_id');
var gr = new GlideRecord("incident");
gr.addQuery('sys_id', sys_id);
gr.query();
gr;
</g:evaluate>
<j:if test="${jvar_gr.next()}">
<j:set var="jvar_phase2" value= "${gr.number} "/>
<j:set var="jvar_phase2" value= "${gr.priority} "/>
<j:set var="jvar_phase2" value= "${gr.impact} "/>
<j:set var="jvar_phase2" value= "${gr.state} "/>
</j:if>

 </j:jelly>

 

TIA

Madhuri

5 REPLIES 5

Christian37
Tera Contributor

Is anyone aware if this can be done the other way around?

Meaning insert data displayed in the Macro into the DB?