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.

UI Page HTML variable in gliderecord

DoDo labs___
Mega Sage

Hello


If I put the sys_id in the UI Page HTML script, the gliderecord works, but if I insert the variable, it doesn't.
I intentionally write out the value of the variable and it writes out the good sys_id.
Can anyone help?

 

 

<j:set var="jvar_pref" value="${sysparm_changeID}"/>
 
<p>${jvar_pref}</p>

<g:evaluate var="jvar_now_GR" object="true" jelly="true">
    var now_GR = new GlideRecord("checklist_item");
    now_GR.addQuery('checklist', ${jvar_pref});
    now_GR.query();
    now_GR;
</g:evaluate>
 
1 ACCEPTED SOLUTION

DoDo labs___
Mega Sage

I found the solution, it has to be put between apostrophes!

 

<j:set var="jvar_pref" value="${sysparm_changeID}"/>
 
<p>${jvar_pref}</p>

<g:evaluate var="jvar_now_GR" object="true" jelly="true">
    var now_GR = new GlideRecord("checklist_item");
    now_GR.addQuery('checklist', '${jvar_pref}');
    now_GR.query();
    now_GR;
</g:evaluate>

 

View solution in original post

1 REPLY 1

DoDo labs___
Mega Sage

I found the solution, it has to be put between apostrophes!

 

<j:set var="jvar_pref" value="${sysparm_changeID}"/>
 
<p>${jvar_pref}</p>

<g:evaluate var="jvar_now_GR" object="true" jelly="true">
    var now_GR = new GlideRecord("checklist_item");
    now_GR.addQuery('checklist', '${jvar_pref}');
    now_GR.query();
    now_GR;
</g:evaluate>