Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

How to call server-side logic from GlideModal UI Page Client Script?

LarissaR4486026
Tera Contributor

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!

0 REPLIES 0