How to read array of object using jelly script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2017 05:43 AM
Hi ,
I am trying to read the values from an array of an object using the jelly script but not able to do so.
Jelly script:
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="jelly:core" xmlns:g2="glide">
<style>
tr.buttons{height:10px;}
</style>
<g:ui_form>
<g:evaluate var="jvar_short_text" expression="RP.getWindowProperties().short_text" />
<g:evaluate
var="jvar_bot_param"
object="true"
expression="RP.getWindowProperties().bot_param" />
<table width="100%">
<j:forEach items="${jvar_bot_param}" var="jvar_param" indexVar="i">
<p>${jvar_bot_param}</p>
<g:evaluate jelly="true" object="true">
var botparam = jelly.jvar_param[i].label;
var botName = jelly.jvar_param[i].name;
</g:evaluate>
<p>${botparam}</p>
<p>${botName}</p>
</j:forEach>
<tr id="dialog_buttons" class="buttons">
<td colspan="2" align="right">
<g:dialog_buttons_ok_cancel ok='return validateComments(${jvar_bot_param})' ok_type="button" cancel_type="button" />
</td>
</tr>
</table>
</g:ui_form>
</j:jelly>
Var jvar_bot_param has the following data:
[{
"name": "incident_sysid",
"label": "Incident sysid",
"type": "text",
"default": "859245f94ffe7e80c5a3c3818110c7fc"
}]
Can someone please look into my code and suggest me how to retrieve the data from array.
Thanks,
Vimal

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2017 06:52 AM
You've already broken out each item in the array as jvar_param, so you don't need a subscript on lines like this:
var botparam = jelly.jvar_param[i].label;
Try this instead
var botparam = jelly.jvar_param.label;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2017 06:55 AM
Hi Chuck,
Thanks for the reply!!
I have tried that one also but could not get the values.Is there any way to check the type of data that is jvar_bot_param has.Something like the type of jvar_bot_param and see.
Thanks,
Vimal

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2017 07:02 AM
In cases like this, try going to System Diagnostics> Debug Log
In your Jelly code you can do a variable dump using <g:breakpoint />
The output can be found in the text below your page output. All the phase 1 variables will be listed there.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2017 01:48 AM
Hi Chuck,
Thanks for the suggestion.
I have tried doing the following but still facing the same issue.
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="jelly:core" xmlns:g2="glide">
<style>
tr.buttons{height:10px;}
</style>
<g:ui_form>
<g:evaluate var="jvar_short_text" expression="RP.getWindowProperties().short_text" />
<g:evaluate
var="jvar_bot_param"
object="true"
expression="RP.getWindowProperties().bot_param" />
<j:set var="jvar_obj" value="${jvar_bot_param}"/>
<p>${jvar_obj}</p>
<j:forEach items="${jvar_obj}" var="jvar_param" indexVar="i">
<g:evaluate jelly="true" object="true">
var botparam = jelly.jvar_param.label;
var botName = jelly.jvar_param.name;
<p>"${botparam}"</p>
<p>"${botName}"</p>
</g:evaluate>
</j:forEach>
</g:ui_form>
</j:jelly>
Error: botparam and botname is not defined.Can you please help me with some suggestion.
Thanks,
Vimal