Jelly script - For loop

ideamax
Mega Expert

Hi,

How can we write the following code in a UI macro?

Need it outside the g:evaluate tag.

for (key in current.variables)

  {

            var v = gcurrent.variables[key];

            gs.log(v.getGlideObject().getQuestion().getLabel());

}

3 REPLIES 3

jcraneNYC
ServiceNow Employee
ServiceNow Employee

Does this work?




<script>


  <j2:forEach var="jvar_key" items="$[current.variables]">


            var v = gcurrent.variables[jvar_key];


            gs.log(v.getGlideObject().getQuestion().getLabel());


  </j2:forEach>


</script>


Anurag Tripathi
Mega Patron
Mega Patron

Use this



<j2:forEach var="jvar_upd" items="$[jvar_updates]">


  <br/>$[jvar_upd]


  </j2:forEach>


-Anurag

ideamax
Mega Expert

Thank you guys,


i found the way, your inputs were valuable