- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2023 06:30 AM
Hi,
i have created a ui action LIST CHOICE type and a UI page.
In the list of records can selecte multiple records in the list view and click on the UI action so that ui page will open. Inside ui page i have created a reference field which refere to user table.
Current condition
<g:ui_reference name="new_user_id" query="active=true^employee_numberISNOTEMPTY" id="new_user_id" table="sys_user" mandatory="true"/>
But i need to see users only users who are part of selected record assignment groups. How can i put this.
Kindly help me
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2023 06:24 AM
try 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">
<style>
.required:before {
content:"* ";
color: red;
}
</style>
<g:evaluate var="jvar_sysId" expression="RP.getWindowProperties().sysparm_id"/>
<g:ui_form>
<input type="hidden" name="selected_record_sysId" value="${sysparm_id}"/>
<p class="required">Please select user to assign selected records</p>
<g:ui_reference name="new_user_id" query="${jvar_users}" id="new_user_id" table="sys_user" mandatory="true^active=true"/>
<br>
</br>
<br>
</br>
<g:dialog_buttons_ok_cancel ok="return validateForm()" cancel="return onCancel()"/>
</g:ui_form>
<g:evaluate var="jvar_users">
var selected_record_sysId = jelly.jvar_sysId;
gs.info("line number 24 group ids--"+selected_record_sysId);
var groupIDS = [];
var recordgroups = new GlideRecord('x_thimi_fin_srvc_request');
recordgroups.addEncodedQuery("sys_idIN"+selected_record_sysId);
recordgroups.query();
while(recordgroups.next()){
groupIDS.push(recordgroups.getValue(assignment_group));
}
var ug = new GlideRecord('sys_user_grmember');
ug.addEncodedQuery("groupIN" + groupIDS);
ug.query();
var list = []; // create an array of user IDs
while (ug.next()) {
list.push(ug.getValue('user')); // add record's user to list as a member of that group
}
list.toString();
</g:evaluate>
</j:jelly>
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2023 06:43 AM
when UI page loads you can set filter
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2023 09:09 AM
Hi Anjur,
In the ui page where i need to put? any help with code or condition
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2023 10:23 AM
Hi ANkur,
Please find below HTML code of my ui page. As of now the reference field is filtering only active true records. But i need to put more filter like as soon as Selected list of records in a table list view and click on choice list UI page will open and users who is part of those selected record assignment groups those users only could able to shown in the reference qualifier.
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<style>
.required:before {
content:"* ";
color: red;
}
</style>
<g:ui_form>
<input type="hidden" name="user_sysId" value="${sysparm_id}"/>
<p class="required">Please select user to assign selected records</p>
<g:ui_reference name="new_user_id" query="active=true^employee_numberISNOTEMPTY" id="new_user_id" table="sys_user" mandatory="true"/>
<br>
</br>
<br>
</br>
<g:dialog_buttons_ok_cancel ok="return validateForm()" cancel="return onCancel()"/>
</g:ui_form>
</j:jelly>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2023 08:26 PM
you will get the selected records assignment group in list choice UI action
Use glideajax and get the users belonging to those groups
pass that as parameter to UI page
please share UI action script here
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader