Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Jelly/Glide script cache problem?

JennyHu
Tera Guru

HI Community,

I have a UI macro that does a GlideRecord query in a <g:evaluate var="jvar_gr" object="true"> tag and print out the record details in a while loop using <j:while>. What I find is that, if the records are updated, the query is not returning updated results.   Is there some settings I can configure to make sure that it always get the latest record data? Does it have to do with clearing the cache?

Thanks,

Jenny

1 ACCEPTED SOLUTION

randrews
Tera Guru

try using a g2 evaluate....



Jelly compiles in 2 passes.. in pass one   <the regular g evaluate> it loads the FORM data.. so put your headers columns etc in that pass.... this information is cached on the server...



in pass 2 <the g2 evaluate> it does NOT cache data... so any record fields should be grabbed in a g2 NOT a g.


View solution in original post

9 REPLIES 9

Hi Christian,



Not yet.   I have submitted a ticket for HI.   I'm currently awaiting a solution.



Thanks,


Jenny


randrews
Tera Guru

try using a g2 evaluate....



Jelly compiles in 2 passes.. in pass one   <the regular g evaluate> it loads the FORM data.. so put your headers columns etc in that pass.... this information is cached on the server...



in pass 2 <the g2 evaluate> it does NOT cache data... so any record fields should be grabbed in a g2 NOT a g.


Thanks Raymond, but still not working for me unfortunately...



Here's my code....any thoughts?



<?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">


<html>



<!-- Perform a Glide Record to get the values of the data points-->


<g2:evaluate var="jvar_gr" object ="true" jelly="true">


gs.info("Testy Testy")


var arr = [];


var sys_id = RP.getParameterValue('sys_id')


var gr = new GlideRecord("table_name");


gr.addQuery('sys_id', sys_id);


gr.query();


while(gr.next()){


arr.push(gr.a_issue);


arr.push(gr.b_issue);


arr.push(gr.c_issue);


};


</g2:evaluate>



<!-- Assign Jelly variables to the 3 data points-->


<g2:evaluate var="jvar_a" expression="arr[0];"/>


<g2:evaluate var="jvar_b" expression="arr[1];"/>


<g2:evaluate var="jvar_c" expression="arr[2];"/>



<!-- Build table to present checkboxes -->


<table width="100%" style="text-align:center;">


<tr>


<td><label>A</label><g:ui_checkbox name="a" value="${jvar_a}"/></td>


<td><label>B</label><g:ui_checkbox name="b" value="${jvar_b}"/></td>


<td><label>C</label><g:ui_checkbox name="c" value="${jvar_c}"/></td>


</tr>


</table>



</html>


</j:jelly>



I can see in the system logs that the first <g2:evaluate> is only running immediately after I update the code. Following that, every time I refresh the page it pulls the cached data.


Hi Christian,



Try replacing the {} brackets with [] brackets when you reference the variables from g2:evaluate.



Example:   Instead of ${jvar_a}, replace it with $[jvar_a]



Thanks,


Jenny


Thanks Raymond.   That's correct.   After I converted the <g evaluate> tag that does the query, it's working now!   I also needed to convert the curly brackets { } to square brackets [ ] when referring to the variables.