- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2021 05:20 AM
So i want a select box in my glideWindow UI Page where i have to display the users that are currently in a list collector of a record.
and i want to show these two users in a select box of UI Page here:
currently im using this script in my UI Page:
<?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:evaluate jelly = "true">
var gr_inc = new GlideRecord('incident');
gr_inc.addQuery('sys_id', '2bdad2b61b5c23038e2520e6e4bcbf4');
gr_inc.query();
</g:evaluate>
<div>
<h2>Please select the users</h2>
<select>
<option>--NONE--</option>
<j:while test="${inc.next()}">
<option value="${inc.sys_id}">${inc.committee_list}</option>
</j:while>
</select>
</div>
</j:jelly>
By passing sys_id in 2bdad2b61b5c23038e2520e6e4bcbf4 addQuery its working but i need g_form.getUniqueValue() of the record or current.sys_id of the record so that it works dynamically for every record.
Any help would be greatly appreciated.
🙂
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2021 07:27 AM
Hi,
This worked well for me
UI Action:
function showPage(){
var gm = new GlideModal('sn_customerservice_show_my_ui_page');
gm.setTitle('My Page');
gm.setSize('600', '600');
gm.setPreference('sysparm_caseID', g_form.getUniqueValue());
gm.render();
}
UI Page:
<?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:evaluate var="jvar_sysId" expression="RP.getWindowProperties().sysparm_caseID"/>
<g:evaluate jelly="true" object="true">
var gr_acp = new GlideRecord('sn_customerservice_case');
gr_acp.addQuery('sys_id', jelly.jvar_sysId);
gr_acp.query();
gr_acp;
</g:evaluate>
<p>${jvar_sysId}</p>
<div>
<h2>Please select the users on behalf of which you would like to endorse the case</h2>
<select>
<option>--NONE--</option>
<j:while test="${gr_acp.next()}">
<option value="${gr_acp.sys_id}">${gr_acp.getDisplayValue()}</option>
</j:while>
</select>
</div>
</j:jelly>
Output:
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2021 05:34 AM
Hi,
if you are calling the UI page from UI action you need to send the current sys_id using parameter
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2021 05:38 AM
Hi,
like this
var dialog = new GlideDialogWindow("approval_ui_page"); 'task_comments_dialog'
dialog.setTitle("Create Approval");
dialog.setPreference("sysparm_sys_id", g_form.getUniqueValue());
dialog.render();
Then in UI page use like this
<g:evaluate var="jvar_sysId" expression="RP.getWindowProperties().get('sysparm_sys_id')" />
<?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:evaluate jelly = "true">
var gr_inc = new GlideRecord('incident');
gr_inc.addQuery('sys_id', '${jvar_sysId}');
gr_inc.query();
</g:evaluate>
<div>
<h2>Please select the users</h2>
<select>
<option>--NONE--</option>
<j:while test="${inc.next()}">
<option value="${inc.sys_id}">${inc.committee_list}</option>
</j:while>
</select>
</div>
</j:jelly>
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2021 06:08 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2021 06:08 AM
And even after trying to write code in below line its still not showing me the users