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
8 hours ago
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 -