- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2023 01:32 AM
Hi,
I have a reference input defined in my UI Page.
I this reference input I want to set the current record value which is not happening. So far I have tried as below:
HTML:
<g:evaluate var="jvar_current" expression="RP.getParameterValue('sysparm_record')"/> //I am passing this from my UI Action
<g:ui_reference name="rec_details" id="rec_details" value="jvar_current" displayvalue="${jvar_current_display}" table="incident" />
Client Script in UI Page:
gel("rec_details").value = g_form.getUniqueValue();
Output coming: A record is getting linked but it is not displaying the record. Please see below:
Please assist.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2023 03:55 AM
update as this and it will work fine.
UI Action
function openPage() {
var dd = new GlideDialogWindow('UI Page Name');
//dd.setTitle(getMessage(""));
dd.setWidth(800);
dd.setPreference('sysparm_record', g_form.getUniqueValue());
dd.setPreference('sysparm_recordDisplayValue', g_form.getValue('number'));
dd.setPreference('sysparm_record_table', g_form.getTableName());
dd.render();
}
UI Page HTML:
<g:evaluate var="jvar_current" expression="RP.getParameterValue('sysparm_record')"/>
<g:evaluate var="jvar_current_table" expression="RP.getParameterValue('sysparm_record_table')"/>
<g:evaluate var="jvar_currentRecordDisplayValue" expression="RP.getParameterValue('sysparm_recordDisplayValue')"/>
<table>
<tr>
<td style="width:25%;padding:5px;">
<g:form_label>Preview Record</g:form_label>
</td>
</tr>
<tr>
<td class ="paddingBetweenCols" style="width:60%">
<g:ui_reference name="rec_details" id="rec_details" value="${jvar_current}" table="${jvar_current_table}" displayValue="${jvar_currentRecordDisplayValue}"/>
</tr>
</table>
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 02:49 AM
Hi,
Your UI Page script should be like 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">
<g:evaluate var="jvar_current" expression="RP.getParameterValue('sysparm_record') "/> //I am passing this from my UI Action
<g:evaluate var="jvar_current_display" expression="RP.getParameterValue('jvar_current_display')"/> // make sure to set jvar_currenty_display value using evalaute by passing that parameter from UI Action
<g:ui_reference name="rec_details" id="rec_details" value="${jvar_current}" table="incident" displayValue="${jvar_current_display}"/>
</j:jelly>
Getting it like above.
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2023 03:44 AM
Thanks for your input. Suggestion provided did not worked for me. Please find the updates which I have done
Please let me know if I am missing something here:
Display value for this table is "Number" on Incident table for us.
UI Action code:
function openPage() {
var dd = new GlideDialogWindow('UI Page Name');
//dd.setTitle(getMessage(""));
dd.setWidth(800);
dd.setPreference('sysparm_record', g_form.getUniqueValue());
dd.setPreference('sysparm_record_table', g_form.getTableName());
dd.setPreference('jvar_current_display', g_form.getValue('number'));
dd.render();
}
UI HTML:
<g:evaluate var="jvar_current" expression="RP.getParameterValue('sysparm_record')"/>
<g:evaluate var="jvar_current_table" expression="RP.getParameterValue('sysparm_record_table')"/>
<g:evaluate var="jvar_current_display" expression="RP.getParameterValue('jvar_current_display')"/>
<table>
<tr>
<td style="width:25%;padding:5px;">
<g:form_label>Preview Record</g:form_label>
</td>
</tr>
<tr>
<td class ="paddingBetweenCols" style="width:60%">
<g:ui_reference name="rec_details" id="rec_details" value="${jvar_current}" table="incident" displayValue="${jvar_current_display}"/>
</tr>
</table>