Getting Values from GlideRecord

rchadek
Kilo Contributor

I'm fairly new to Jelly and the ServiceNow platform in general. I'm trying to build a UI Page and I have the shell of my HTML built but I'm having some trouble accessing the values in the GlideRecord. I have this code in place:

    <g:evaluate var="jvar_cmg_io" object="true" jelly="true">

          var io = new GlideRecord('x_cmgrs_digital_io_intake');            

          io.addQuery('status', 'Open');

          io.addQuery('number', 'ORD0002455');

          io.query();

    </g:evaluate>

Then, later when I try to output the Order Number for instance, I'm not getting any output.

    <strong>Order Number:</strong> ${ jvar_cmg_io.number }

Any help would be much appreciated. Thanks.

26 REPLIES 26

Looking at your steps, table name seem to be correct, there is another way you can check through URL.


Just right click on the same form and select "Copy URL", your URL should have the same table name.



For example It should be :   https://<InstanceName>.service-now.com/nav_to.do?uri=x_cmgrs_digital_io_intake.do?sys_id=<Example: d71f7935c0a8016700802b64c67c11c6&>


Yes, that's what I'm seeing for "Copy URL".


Interesting....lets try one more thing by just changing the table name and see if we get any result set.


We can rename x_cmgrs_digital_io_intake   to   incident and see if returns anything from incident table.




<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">


  <g:evaluate var="jvar_cmg_io" object="true" jelly="true">


          var io = new GlideRecord('incident');      


          io.query();


          io;


    </g:evaluate>


    <j:while test="${jvar_cmg_io.next()}">


            <p>Order Number:<strong> ${HTML:jvar_cmg_io.getValue('number')}</strong></p>


  </j:while>


</j:jelly>




Hope this one would work!


Nothing returned that way either. I also tried changing the 'getValue' parameter to 'short_description'.


Oops! This should actually work, its working fine on Fuji instance please refer this link: ServiceNow


To login just use "admin" as UserID & Pwd.