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.

Looping through an array in JellyScript

Alex Ng
Tera Contributor

Hi all,

I have a single dimension array that was populated in the <g2> tag in UI Page. In the same page, I wanted to loop through this array in the jelly tag to populate a table in HTML. Does anyone knows how to do this? The code I had in <g2> tag is as followed and needs to be converted to jellyscript for the looping:

for (var i = 0; i < assignedIdList.length; i++) {

gs.print(assignedIdList[i]);

}

Your help is appreciated.

Thank you.

5 REPLIES 5

You need to refer to jvar_color as follows:      




<td>${jvar_color}</td>


          <td>${jvar_color.name}</td>


          <td>${jvar_color.value}</td>



ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022