- 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 06:17 AM
Hi,
this line should be inside the jelly
Also I assume you are sending the parameter from UI action to this UI page so you must have added like this
dialog.setPreference("sysparm_sys_id", g_form.getUniqueValue());
so update as this
<?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().get('sysparm_sys_id')" />
<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:26 AM
Hi Ankur this is my code:
UI Action:
function showCommitteeUsers()
{
var gm = new GlideModal('x_adsr_endorse_for_member');
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().get('sysparm_caseID')"/>
<g:evaluate jelly = "true">
var gr_acp = new GlideRecord('x_adsr_acp');
gr_acp.addQuery('sys_id','${jvar_sysId}');
gr_acp.query();
</g:evaluate>
<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('committee_selection_list')}</option>
</j:while>
</select>
</div>
</j:jelly>
But im still not able to see the values in Select Box
😞
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2021 06:39 AM
So you are using scoped application
try to update as this
<?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" value="${RP.getWindowProperties()['sysparm_caseID']}"/>
<g:evaluate jelly = "true">
var gr_acp = new GlideRecord('x_adsr_acp');
gr_acp.addQuery('sys_id','${jvar_sysId}');
gr_acp.query();
</g:evaluate>
<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('committee_selection_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:51 AM
- 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