- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2016 04:54 AM
I need to pass the retrieved value from g:evaluate outside of it. Here in the below script i have inci.name from g:evaluate want to pass it to <td> tag .how can i do this?
<tr>
<g:evaluate var="jvar_data" object="true">
var inci = new GlideRecord('sc_cat_item');
inci.get("${cbr.sys_id}");
inci.name;
gs.log("inci.name==>"+"${jvar_data}"); // It is empty
gs.log("inci.name_cat"+inci.name); // I can get this data in log
</g:evaluate>
<td>${jvar_data}</td>
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2016 04:59 AM
Just assign that property to any variable and you can access that variable in jelly script.
<tr>
<g:evaluate var="jvar_data" object="true">
var inci = new GlideRecord('sc_cat_item');
inci.get("${cbr.sys_id}");
var incidentname = inci.name;
</g:evaluate>
<td>${incidentname}</td>

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2016 04:58 AM
Hi Malu,
Try this
Change inci.name to inci.getValue('name') (to strip out the value and not get all the attached methods.)
Make the last statement in your g:evaluate block.
I wouldn't worry about object="true". You are not returning an object.
<g:evaluate var="jvar_data">
var inci = new GlideRecord('sc_cat_item');
inci.get("${cbr.sys_id}");
inci.getValue('name');
</g:evaluate>
<td>${jvar_data}</td>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2016 04:59 AM
Just assign that property to any variable and you can access that variable in jelly script.
<tr>
<g:evaluate var="jvar_data" object="true">
var inci = new GlideRecord('sc_cat_item');
inci.get("${cbr.sys_id}");
var incidentname = inci.name;
</g:evaluate>
<td>${incidentname}</td>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2016 06:51 AM
I got this worked on changing the code as below
<tr>
<g:evaluate var="jvar_data">
var conf= new GlideRecord('sc_cat_item');
conf.get("${cbr.sys_id}");
conf.name;
</g:evaluate>
<td>${jvar_data}</td>
Thanks Everyone
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2016 05:04 AM
Hi,
you dont have to make it so difficult.
Take a look at this example:
This gets a incident record inside the evalute, then I can use that object outside of the evaluate
<?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>
var grtest = new GlideRecord('incident');
grtest.get('1e03cf840f7312004cf365ba32050eaa');
</g:evaluate>
<h1> ${grtest.short_description}</h1>
</j:jelly>
//Göran