How to pass sysid of the workspace page to ui page?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2023 03:31 AM
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.
Thanks in Advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2023 04:28 AM
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}" />
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2023 05:15 AM
value not populating in input @Ankur Bawiskar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2023 05:58 AM
please share your UI page script
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2023 06:05 AM - edited 04-06-2023 06:06 AM
@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,
});
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2024 07:12 AM
I would change your code from line 6 to this: