
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2016 03:25 PM
Needing help developing a UI page dialog box to re-assign a ticket based upon a ui action button. Where I'm stuck is getting the UI Reference field for the assigned to field to be dependent on the assignment group.
<g:ui_form>
<!-- Get the values from dialog preferences -->
<g:evaluate var="jvar_short_text"
expression="RP.getWindowProperties().get('short_text')" />
<g:evaluate var="jvar_comments_text"
expression="RP.getWindowProperties().get('assigned_to_text')" />
<g:evaluate var="jvar_assignment_group"
expression="RP.getWindowProperties().get('assignment_group')" />
<!-- Set up form fields and labels -->
<table width="100%">
<tr id="description_row" valign="top">
<td colspan="2">
<!-- Short description value used as a label -->
${jvar_short_text}
</td>
</tr>
<tr>
<td>
<!-- Assigned to input reference field -->
<g:ui_reference name="assigned_to" id="assigned_to" table="sys_user" query="group=${jvar_assignment_group}" label="Assign to Problem Manager:"
mandatory="true" />
</td>
</tr>
<tr>
<td colspan="2">
</td>
</tr>
<tr id="dialog_buttons">
<td colspan="2" align="right">
<!-- Add OK/Cancel buttons. Clicking OK calls the validateComments script -->
<g:dialog_buttons_ok_cancel ok="return validateInput()" ok_type="button" cancel_type="button" />
</td>
</tr>
</table>
</g:ui_form>
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2016 04:40 PM
Here's the conceptual code (totally untested)
<g:evaluate var="jvar_users">
var ug = new GlideRecord('sys_user_grmember');
ug.addQuery('group', "${jvar_assignment_group}"); // use your jelly variable here for the group to filter
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
}
var users = list.join(','); // create comma separated values
users; // save it to jvar_users
</g:evaluate>
Now you can use jvar_users as your reference qualifier in the g:ui_reference tag.
query="sys_idIN${jvar_users}"

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2016 03:34 PM
Hi Alex,
You're going to have to query sys_user_grmember and use the group argument you got to retrieve the member sys_ids and change your query from group=${jvar_assignment_group} to userIN${jvar_user_ids} where jvar_user_ids is a comma separate list of sys_ids.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2016 04:34 PM
Hi Chuck,
how would i setup the query? I'm new to creating UI pages, and my attempts to do so, have created errors when triggering the dialog box.
Thanks,
Alex

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2016 04:40 PM
Here's the conceptual code (totally untested)
<g:evaluate var="jvar_users">
var ug = new GlideRecord('sys_user_grmember');
ug.addQuery('group', "${jvar_assignment_group}"); // use your jelly variable here for the group to filter
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
}
var users = list.join(','); // create comma separated values
users; // save it to jvar_users
</g:evaluate>
Now you can use jvar_users as your reference qualifier in the g:ui_reference tag.
query="sys_idIN${jvar_users}"

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2016 07:21 PM
This works awesomely! I see now that my query attempts were only completing half the picture.
Thank you!