How to pass sysid of the workspace page to ui page?

Uday_Kumar
Giga Guru

Hi @Ankur Bawiskar @Community Alums @AndersBGS  @Allen Andreas @Prince Arora @AnveshKumar M 

I need to pass the sysid of the workspace page to the ui page normally we use set preference in glidedialogwindow but in workspace ui actions we use g_modal. can anyone please help me out how to pass sys_id of the workspace page to ui page through workspace ui action script.

Uday_Kumar_0-1680777069250.png

Thanks in Advance

16 REPLIES 16

@Uday_Kumar 

pass that in URL parameter and then get it in UI page

like this

function onClick(g_form) {
var ui_page_id = '0719e6dd978221109d6933121153af44';
g_modal.showFrame({
url: '/ui_page.do?sys_id=' + ui_page_id + '&sysparm_sysId=' + g_form.getUniqueValue(),
title: 'Assign',
size: 's',
height: 200,

});

Inside UI page HTML use this to get the value

<input type="text" name="myparam" value="${sysparm_sysId}" />
Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

value not populating in input @Ankur Bawiskar 

@Uday_Kumar 

please share your UI page script

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Ankur Bawiskar Please check

HTML:

 

<?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>
<body onload="makeReadonly()">
<!-- <g:evaluate var="jvar_text" expression ="RP.getWindowProperties().get('sys_id')" /> -->
<g:evaluate jelly="true">
	var sys=RP.getParameterValue('sysparm_sysId');
</g:evaluate>
<!-- <g:evaluate var="jvar_sysid" expression ="RP.getParameterValue('sysId')" /> -->
<input type="text" name="myparam" value="${sys}" />
<table border="0" width="100%">
<tr>
<td>
Assignment Group: <g:ui_reference name="group" id="group" table="sys_user_group" completer="AJAXTableCompleter" query="active=true" onchange="setUserFilter()"/>
</td>
<tr>
<td>
Assigned To: <g:ui_reference name="userRecords" id="userRecords" table="sys_user" completer="AJAXTableCompleter"/>
</td>
</tr>
</tr>
<tr>
<td>
<g:dialog_buttons_ok_cancel cancel="return onCancel();" ok="return onSubmit();"/>
<input type="" id="task_sys_id" name="task_sys_id" value="${jvar_sys}"/>
</td>
</tr>
</table>
</body>
</g:ui_form>
</j:jelly>

 

Workspace client:

 

function onClick(g_form) {
    var ui_page_id = '0719e6dd978221109d6933121153af44';
    g_modal.showFrame({
        url: '/ui_page.do?sys_id=' + ui_page_id +''+ '&sysparm_sysId=' + g_form.getUniqueValue(),
        title: 'Assign',
        size: 's',
        height: 200,

    });

    
}

 

I would change your code from line 6 to this:

<g:evaluate var="sysparm_id">
var rec = new GlideRecord('x_270032_siarra_siarra_task');
rec.query();
rec;
var sysparm_id = RP.getParameterValue("sysparm_id"); sys_id;
</g:evaluate>
<input type="hidden" name="task_sys_id" id="task_sys_id" value="${RP.getParameterValue('sysparm_id')}"/>