How to call server-side logic from GlideModal UI Page Client Script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi community,
I'm building a feature where:
1. User selects records from a related list using checkboxes
2. Clicks a UI Action button that opens a GlideModal (UI Page)
3. Inside the modal, user selects a template option
4. Clicks "Export" to generate a PDF
The problem: I need to call server-side logic (a Script Include) when the user clicks Export inside the modal. I've tried:
- GlideAjax inside the modal → returns null (seems blocked in iframe context)
- Client Script field of UI Page → function not loaded inside GlideModal
- Scripted REST API via fetch → 401 Unauthorized even with authentication disabled on the resource
- window.opener / window.parent to redirect → opener is null inside the modal
My setup:
- UI Action on rm_story table (Client: true, List banner button)
- Onclick opens GlideModal with setPreference('sysparm_selected_ids', ids)
- UI Page with HTML + Client Script
- Script Include with Client callable: true
Question: What is the correct way to execute server-side code (Script Include or similar) when a button is clicked inside a GlideModal UI Page?
Any working example would be greatly appreciated!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
correct way is , you can call GlideAjax from a UI Page client script. Make sure you are passing the correct parameters from the client side to the server-side script.
It’s also a good idea to add debug logs (both client-side and server-side) so you can easily identify where the issue might be occurring.
Additionally, ensure that your UI Page and UI Action are in the correct scope to avoid any access or execution issues.
Before implementing the complete logic, try testing with some demo data first. Once everything works as expected, you can proceed with building the full solution.
If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Thank You