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
4 weeks 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 -
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Hi @Ajays0396044436 ,
Make sure that your client callable script where Ajax resides is set to this scope application only not all applications.
please mark helpful if this solves your problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Yes, It is client callable and in the same scope.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
is your script include client callable?
is the ajax call working?
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Yes, My script include is client callable and I am using glideAjax from client side to trigger it.