- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-06-2025 03:05 AM
Hi! I am trying to take a field value from the form and use this to populate a field on a UI page with that value.
But it is not setting/getting the value. If i make my tags $[] I get a black reference value but if I use ${} I get no reference at all, I want to take the value from the record that is already populated.
<g2:evaluate var="jvar_cmdb_id" jelly="true">
var val = current.getValue('cmdb_ci');
val;
</g2:evaluate>
<g:ui_reference label="configuration_item" name="configuration_item" table="cmdb_ci" field="name" value="$[jvar_cmdb_id]" displayvalue="Testing" />
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2025 03:03 AM
since you are in scoped app try this
<g:evaluate var="jvar_ci_sys_id" expression="RP.getWindowProperties().sysparm_ci_sys_id" />
<g:evaluate var="jvar_ci_display" expression="RP.getWindowProperties().sysparm_ci_display" />
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2025 02:36 AM
Thanks for trying Ankur!
Sadly I am not sure what is working, I tried both of your solutions with no luck - does anything look wrong?
UI Action: Quick Close:
function quickClose() {
var title = getMessage("Quick Close");
var sysId = g_form.getUniqueValue();
var dialogClass = GlideModal ? GlideModal : GlideDialogWindow;
var dd = new dialogClass("sn_si_quick_close_si");
dd.setTitle(title);
dd.setPreference('sysparm_ci_sys_id', g_form.getValue('cmdb_ci').toString());
dd.setPreference('sysparm_ci_display', "Testing");
dd.setPreference('sysparm_sys_id', sysId);
dd.setPreference('sysparm_action', "incident");
dd.setWidth(500);
dd.render();
}
And ui page:
<div class="row form-section">
<div class="col-sm-4 section-title-top"><span mandatory="true" class="required-marker"></span>${gs.getMessage('Configuration Item : ')}</div>
<div class="col-sm-6">
<g:evaluate var="jvar_ci_sys_id" expression="RP.getWindowProperties().get('sysparm_ci_sys_id')" />
<g:evaluate var="jvar_ci_display" expression="RP.getWindowProperties().get('sysparm_ci_display')" />
<input type="hidden" id="changerequest1" name="changerequest1" value="${jvar_ci_sys_id}"></input>
<div id='mydiv3'>
<label id='label3' value="${jvar_ci_sys_id}"></label>
<g:ui_reference name="changerequest" id="changerequest" table="change_request" value="${jvar_ci_sys_id}" displayValue="${jvar_ci_display}" style="width:180px" />
</div>
<g:ui_reference label="Configuration Item" name="configuration_item" table="cmdb_ci" field="name" value="${jvar_ci_sys_id}" displayvalue="${jvar_ci_display}" />
</div>
</div>
Result:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2025 03:11 AM
try this and send the CI display value
function quickClose() {
var title = getMessage("Quick Close");
var sysId = g_form.getUniqueValue();
var ciName = g_form.getDisplayBox('cmdb_ci').value;
var dialogClass = GlideModal ? GlideModal : GlideDialogWindow;
var dd = new dialogClass("sn_si_quick_close_si");
dd.setTitle(title);
dd.setPreference('sysparm_ci_sys_id', g_form.getValue('cmdb_ci').toString());
dd.setPreference('sysparm_ci_display', ciName);
dd.setPreference('sysparm_sys_id', sysId);
dd.setPreference('sysparm_action', "incident");
dd.setWidth(500);
dd.render();
}
UI Page: No change
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2025 10:53 PM
Hope you are doing good.
Did my reply answer your question?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2025 02:47 AM
Hi Ankur! Thanks for your continued help - unfortunately it still doesn't work, I have debugged a little and this is what I see in the logs:
com.glide.script.RhinoEcmaError: Cannot find function get in object [object Object].
ftp://gsft_database_form/sys_ui_page.ec34dd401b019d906a3c8551f54bcb0c.html âžš.69 : Line(1) column(0)
==> 1: RP.getWindowProperties().get('sysparm_ci_display')
Think this could be scope issue from security incident response?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2025 03:03 AM
since you are in scoped app try this
<g:evaluate var="jvar_ci_sys_id" expression="RP.getWindowProperties().sysparm_ci_sys_id" />
<g:evaluate var="jvar_ci_display" expression="RP.getWindowProperties().sysparm_ci_display" />
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader