- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi,
I tried adding an advanced reference qualifier on a UI Page, but it’s not working as expected. I want to display the values dynamically based on the current record. Could someone help me resolve this issue?
Thanks in advance
Script:
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi Suvitha,
This usually happens because the <g:ui_reference> tag expects a pure encoded query string, but the Script Include call inside the query attribute is not being executed the way we think. The Jelly engine treats it as a literal string, so the filter never applies.
To make the dynamic qualifier work on a UI Page, we need to evaluate the Script Include server-side first and then pass the returned encoded query to the reference field.
Here’s the working approach:
<g:evaluate var="jvar_sys_id" expression="RP.getParameterValue('sysparm_sys_id');" />
<!-- Execute the Script Include on the server and store the encoded query -->
<g:evaluate var="qual" expression="(new x_Utils()).getXXXXUsers(jvar_sys_id)" />
<input type="hidden" id="record_sys_id" value="${jvar_sys_id}" />
<g:ui_form>
<table border="0" width="100%">
<tr>
<td style="width:10%">
<label for="Business XXX">Business XXX</label>
</td>
<td style="width:25%">
<!-- Use the evaluated qualifier here -->
<g:ui_reference name="user" id="user" table="xxxxxx" query="${qual}" />
</td>
</tr>
</table>
</g:ui_form>
A couple of notes that helped me debug this:
Ensure your Script Include getXXXXUsers() returns a valid encoded query, something like:
active=true^business_unit=<some_sys_id>You can temporarily print these values for testing:
<pre>sys_id = ${jvar_sys_id}</pre>
<pre>qual = ${qual}</pre>
Once I switched to this pattern, the reference qualifier started filtering correctly based on the current record.
If this helps you, please mark the answer as Resolved so it can help others too. 😊
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi Suvitha,
This usually happens because the <g:ui_reference> tag expects a pure encoded query string, but the Script Include call inside the query attribute is not being executed the way we think. The Jelly engine treats it as a literal string, so the filter never applies.
To make the dynamic qualifier work on a UI Page, we need to evaluate the Script Include server-side first and then pass the returned encoded query to the reference field.
Here’s the working approach:
<g:evaluate var="jvar_sys_id" expression="RP.getParameterValue('sysparm_sys_id');" />
<!-- Execute the Script Include on the server and store the encoded query -->
<g:evaluate var="qual" expression="(new x_Utils()).getXXXXUsers(jvar_sys_id)" />
<input type="hidden" id="record_sys_id" value="${jvar_sys_id}" />
<g:ui_form>
<table border="0" width="100%">
<tr>
<td style="width:10%">
<label for="Business XXX">Business XXX</label>
</td>
<td style="width:25%">
<!-- Use the evaluated qualifier here -->
<g:ui_reference name="user" id="user" table="xxxxxx" query="${qual}" />
</td>
</tr>
</table>
</g:ui_form>
A couple of notes that helped me debug this:
Ensure your Script Include getXXXXUsers() returns a valid encoded query, something like:
active=true^business_unit=<some_sys_id>You can temporarily print these values for testing:
<pre>sys_id = ${jvar_sys_id}</pre>
<pre>qual = ${qual}</pre>
Once I switched to this pattern, the reference qualifier started filtering correctly based on the current record.
If this helps you, please mark the answer as Resolved so it can help others too. 😊