- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-16-2012 10:22 AM
I have an Assignment Group and Assigned to fields on an UI Page. I want to filter the Assigned To list by "active=true^roles=itil" and the Assignment Group.
I don't know how to do this, and there isn't much documentation. Any ideas?
I tried adding "'QUERY:active=true^roles=itil" to the name, but that messes up the processing script. Also I can't figure out how to filter the users by the groups selected in this UI Page.
Here is my 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"> <form action="ui_page_process.do"> <input type="hidden" name="name" value="hp_planned_task_creator"/> <input type="hidden" id="cancelled" name="cancelled" value="false"/> <g:evaluate> var parent_task = '${sysparm_sysID}'; </g:evaluate> <table> <tr> <td nowrap="true"> <label>Assignment Group:</label> </td> <td> <g:ui_reference name="assignment_group" id="assignment_group" table="sys_user_group" value="${sysparm_group_value}" displayvalue="${sysparm_group_displayvalue}"/> </td> </tr> <tr> <td nowrap="true"> <label>Assigned to:</label> </td> <td> <g:ui_reference name="assigned_to" id="assigned_to" table="sys_user"/> </td> </tr> <tr> <td nowrap="true"> <label>Time Card Active:</label> </td> <td> <g:ui_checkbox name="timecard_active" value="${sysparm_timecard_active}"/> </td> </tr> <tr> <td nowrap="true"> ${gs.getMessage('Quantity')}: </td> <td> <input name="task_quantity" id="task_quantity" value="1"/> </td> </tr> <tr> <td align="right" colspan="2"> <g:dialog_buttons_ok_cancel ok="return true;" cancel="return onCancel();" /> </td> </tr> </table> <input type="hidden" name="parent_task" id="parent_task" value="${sysparm_sysID}"/> </form> </j:jelly>
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-20-2012 06:53 AM
I figured out how to filter the ui_reference field.
<g:ui_reference name="QUERY:active=true^roles=itil" id="assigned_to" table="sys_user" />
Then in the Processing Script, you reference that name field like this:
newTask.assigned_to = request.getParameter("QUERY:active=true^roles=itil");
Now I want to make this ui_reference field dependent on another ui_reference. For instance, I have an Assignment field and an Assigned To field. I want the assigned to dependent what the Assignment field is selected?
Is there a parameter with a ui_reference to make it dependent on another field?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-20-2012 06:53 AM
I figured out how to filter the ui_reference field.
<g:ui_reference name="QUERY:active=true^roles=itil" id="assigned_to" table="sys_user" />
Then in the Processing Script, you reference that name field like this:
newTask.assigned_to = request.getParameter("QUERY:active=true^roles=itil");
Now I want to make this ui_reference field dependent on another ui_reference. For instance, I have an Assignment field and an Assigned To field. I want the assigned to dependent what the Assignment field is selected?
Is there a parameter with a ui_reference to make it dependent on another field?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-25-2015 05:23 AM
Hi Mike,
You didn't mention which Service-now release you are on. Because UI reference has changed a bit in newer release of Service-now. Because per Service now "..beginning with the Calgary release, this tag has been enhanced to allow you to specify a reference qualifier, so that the "name" attribute can be unique...."
Extensions to Jelly Syntax - ServiceNow Wiki
If you are on older releases you can still achieve this using little bit client scripting and some session data usage.
In your assignment group reference field add a onChange function updateRefQual. This function can call up a ajax script and populate a session data with current assignment group. This session data can be utilized in a utility class for eg:
var SomeUtilClass = Class.create();
SomeUtilClass.getAssignedToRefQual() {
var assignGroup = return gs.getSession().getClientData('assignGroup');
var refQual = 'sys_user_group='+assignGroup;
return refQual;
};
<g:ui_reference name="assignment_group" id="assignment_group" onChange="javascript:updateRefQual(this.value);" table="sys_user_group" value="${sysparm_group_value}" displayvalue="${sysparm_group_displayvalue}"/>
Now in your assigned to ui referenced field you could have a dynamic filter
<g:ui_reference name="assigned_to" name="QUERY:JSCRIPT:SomeUtilClass.getAssignedToRefQual();" id="assigned_to" table="sys_user"/>
Hope this helps!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-25-2015 10:50 AM
The post was from Jan 20, 2012, maybe pre-Aspen. The top post says 2014, but that date was probably from the forum migration. Time flies by! It doesn't seem that long ago.
Thanks for the information though.
Mike
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2015 04:53 AM
Hi Mike,
Do you have an example of this working? I have been attempting to pass an assignment group as a param to a ui page and using it in a ui_reference to filter by grouped users. Any help would be much appreciated. Thanks