how do I get a variable value from UI action script into UI page using <g:evaluate> tag

shreyajoshi
Kilo Expert

UI action code :-

function recordValue()

{

 

  var num = g_form.getValue('number'); // get the value to pass into the dialog.

  alert('num is'+ num);

var gdw = new GlideDialogWindow('task_info_dialog'); // Initialize and open the dialog window

gdw.setTitle("Record is:");

      gdw.setPreference("num1", num);

gdw.render();

}

UI PAge code in HTML section -

<?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:ui_form>

  <!-- Get values from dialog preferences passed in -->

  <g:evaluate var="jvar_num1" object ="true" expression="RP.getWindowProperties().get('num1')" >

  gs.log('inside ui page');

  gs.log('number is:' +number);

  var gr = new GlideRecord('sc_task');

    gr.addQuery('number',${jvar_num1});

    gr.query();

    gr;

</g:evaluate>

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

    <g:ui_multiline_input_field name="dial_comments" id="dial_comments" label="number" value="${jvar_num1}" mandatory="true" />

</j:while>

 

  </g:ui_form>

</j:jelly>

_____________________________________________________________________________________

but I am unable to get value of num1 from UI action script

1 ACCEPTED SOLUTION

nayanawadhiya1
Kilo Sage

Hey Shreya,



For accessing the jelly variable in g:evaluate use jelly = "true" that will allow you to use jelly variables in g:evaluate


Like this -


find_real_file.png


Thats UI Action -


find_real_file.png


View solution in original post

7 REPLIES 7

nayanawadhiya1
Kilo Sage

Hey Shreya,



For accessing the jelly variable in g:evaluate use jelly = "true" that will allow you to use jelly variables in g:evaluate


Like this -


find_real_file.png


Thats UI Action -


find_real_file.png


Hi nayan...





I have used below code to display value of reference field. However it is not working. Could you please check if it's correct?



<tr><td>Assigned To:</td><td>${jvar_gr.assigned_to.getDisplayValue()}</td></tr>


Wrote like that -



${jvar_gr..getDisplayValue('assigned_to')};


while writing UI page do I have to select category as well? If it's then which should I use?


For now I have used general category.