UI Page GlideAjax not triggering when passing value from UI Macro/GlideModal using setPreference
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2026 01:20 PM
Hi Everyone,
I am working on a requirement where I created a custom button using a UI Macro and displayed it on the form using a Formatter.
When user clicks the button:
- A GlideModal opens
- A UI Page loads
- I pass a CyberGRX ID from UI Macro to UI Page using:
gm.setPreference("sysparm_grx_id", grx_id);
Inside the UI Page, I am able to retrieve and display the value successfully using:
<g>
var grxId = RP.getParameterValue('sysparm_grx_id');
</g>
and:
${grxId}
The issue:
I am trying to use this grxId inside client-side JavaScript in the UI Page and trigger a GlideAjax call, but the API/GlideAjax is not executing.
UI PAGE HTML code is: -
<?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 grxId = RP.getParameterValue('sysparm_grx_id');
</g:evaluate>
<h2>CyberGRX ID:</h2> ${grxId}
<script>
var grxId = "${grxId}";
showData();
</script>
<div>
<!-- <p>"This is just a demo for review."</p> -->
<table border="1" style="width:100%; border-collapse:collapse; text-align:left;">
<thead>
<tr>
<th>Risk Domain</th>
<th>Domain Index</th>
<th>Domain Index Rating</th>
<th>Domain Impact</th>
<th>Domain Descriptiong</th>
</tr>
</thead>
<tbody id="tableBody"></tbody>
</table>
</div>
</j:jelly>
and Client script code is like -
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2026 11:06 PM
1. In the Client Script section of your UI Page, use GlideModal's get().getPreference()to access the ID you passed from the UI Macro.
2. Instead if RP.getParameterValue , try with RP.getWindowProperties()
Refer code from this post:
https://www.servicenow.com/community/developer-forum/custom-glidemodal/m-p/2837020
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a month ago
Hello Tanu,
The issue is my server side code is not triggering in my ui page client script section side. I am successfully receiving the grx id from UI macro with the RP.getParameterValue() method.
Is my script include look fine. it is client callable as well. still not triggering, that's the issue i am not understanding why it is ?