How to make <g:ui_reference> dynamic reference filter using UI Page?

Santosh Kallim1
Giga Contributor

I have created UI page and called from UI action in incident table,

<g:ui_reference name="parent_id" id="parent_id" table="sys_user" query="active=false"/>

I want to filter the reference list with ('active=false^u_incident=' + sys_id),

Can anybody suggest me how can I achieve this ?

 

 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Santosh,

You can achieve this as below

I assume this UI action is on Incident table and you want to send current incident sys_id to UI page

The UI page will display user records where it is active=false and current incident

Sample UI Action:

Onclick: showIncident()

Script:

function showIncident(){

    var sysId = g_form.getUniqueValue();
    var gDialog = new GlideDialogWindow('show_Incident');
    gDialog.setSize('600','600');
    gDialog.setPreference('sysparm_sysID', sysId);
    gDialog.setTitle('Create Incident');
    gDialog.render();

}

Sample UI Page:

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">

<j:set var="jvar_incident_id" value="${RP.getWindowProperties().get('sysparm_sysID')}"/>

<g:ui_reference name="incident" id="incident" table="incident" completer="AJAXTableCompleter" query="active=false^u_incident=${jvar_incident_id}"/>

</j:jelly>

Regards
Ankur

 

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

1 REPLY 1

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Santosh,

You can achieve this as below

I assume this UI action is on Incident table and you want to send current incident sys_id to UI page

The UI page will display user records where it is active=false and current incident

Sample UI Action:

Onclick: showIncident()

Script:

function showIncident(){

    var sysId = g_form.getUniqueValue();
    var gDialog = new GlideDialogWindow('show_Incident');
    gDialog.setSize('600','600');
    gDialog.setPreference('sysparm_sysID', sysId);
    gDialog.setTitle('Create Incident');
    gDialog.render();

}

Sample UI Page:

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">

<j:set var="jvar_incident_id" value="${RP.getWindowProperties().get('sysparm_sysID')}"/>

<g:ui_reference name="incident" id="incident" table="incident" completer="AJAXTableCompleter" query="active=false^u_incident=${jvar_incident_id}"/>

</j:jelly>

Regards
Ankur

 

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader