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.

How to retrieve a value from a current record in Jelly script?

xuan
Giga Contributor

Hi all,

Basically, I need a UI macro to retrieve the value of a filed from the current record.

I tried the following jelly script, it returns null.

<g:evaluate var="jvar_test">
var val = ${ref}.test_field;
</g:evaluate>

I also tried this, it doesn't work.

<j:set var="jvar_test" value="${current.test_field}">

Can anyone help?

Thanks in advance.

Xuan

1 ACCEPTED SOLUTION

Try below



<g2:evaluate var='jvar_id'>

          var val = current.getValue('caller_id');


val;

</g2:evaluate>


$[jvar_id]   // will print the sysid of caller


View solution in original post

7 REPLIES 7

BrianD502676804
Kilo Sage

Hi Xuan,



Try:



<g:evaluate var="jvar_test">
          var val = current.test_field;


        val;
</g:evaluate>




Your variable will be passed on to the rest of the script as "jvar_test".



Note: If "test_field" is a reference and you are just passing the sys_id value, use "var val = current.test_field.toString();"





Thanks,


-Brian


Where are you using the ui macro?


Formatter.


Try below



<g2:evaluate var='jvar_id'>

          var val = current.getValue('caller_id');


val;

</g2:evaluate>


$[jvar_id]   // will print the sysid of caller