Issue with passing a variable from UI action to UI page

RuizheZ
Tera Contributor

I can't seem to pass a variable from my UI action into a UI page despite following the syntax and examples. It always outputs to nothing. 

 

UI action: 

function processAssets() {
    var itemList = g_list.getChecked().toString();
    if (itemList) {
        var dialogClass = (typeof GlideModal !== 'undefined') ? GlideModal : GlideDialogWindow;
        var dd = new dialogClass('asset_return');
        dd.setTitle('Asset Return');
        console.log('Itemlist: ' + itemList);
        dd.setPreference('ids', itemList);
        dd.setWidth(800);
        dd.render();
    }
}
 
UI Page HTML: 
<g:ui_form>
<input type="hidden" id="sys_ids" name="sys_ids" value="${ids}"/>
<div style="display:flex; flex-direction: row; justify-content:center; gap: 20px" id="main">
</div>
</g:ui_form>

UI Page Client Script: 
generateBody();

function generateBody() {
    var sys_ids = gel('sys_ids').value;
    debugger;
    console.log("Here: " + sys_ids);
}
0 REPLIES 0