(SOW) - How to make a modal completely non-dismissible (hide X button and prevent ESC key)?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi Team,
I am working on a custom Change Management requirement in (SOW) and am looking for guidance on making a modal completely non-dismissible.
The popup presents two options:
- Amend Implementation Date
- Proceed as Emergency Change
The business requirement states that the popup must be mandatory and non-dismissible.
Users should not be able to:
- Close the popup using the X button
- Close the popup using the ESC key
- Bypass the popup without selecting one of the two options
- Added keydown handlers to prevent the ESC key.
- Attempted to locate and hide/remove the modal close (X) button.
- Attempted to disable click events on the close button.
- Tested both g_modal.showFields() and g_modal.showFrame() approaches.
Is there a supported way in Service Operations Workspace to create a modal that:
- Hides the Close (X) button
- Prevents the ESC key from closing the modal
- Prevents dismissal without selecting an action
Any examples or supported approaches would be greatly appreciated.
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
18m ago
ahoy @Apurva127,
from perspective of user experience this is a nightmare and I believe it's not even possible to ignore pressing escape or if it is possible then it would be an absolute overkill not worthy the efforts...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
16m ago
Hi @Apurva127 ,
Unfortunately, Service Operations Workspace does not provide a supported mechanism in g_modal.showFields() or g_modal.showFrame() to remove the Close (X) button or prevent the ESC key from dismissing the modal. The close functionality is handled by the underlying Workspace modal framework and is not configurable through the standard APIs.
As a supported solution, I recommend blocking the Change submission when the 7-day lead-time requirement is not met and displaying the modal with the two available actions:
Amend Implementation Date
Proceed as Emergency Change
The submission should remain blocked until the user selects one of these options. Even if the user clicks the Close (X) button, no action should be performed and the Change should not be submitted. The validation will be triggered again when the user attempts to submit the Change.
This approach achieves the business requirement of preventing users from bypassing the lead-time validation while remaining upgrade-safe and aligned with ServiceNow Workspace best practices.
If a truly non-dismissible popup is mandatory (no Close button, no ESC key, and no ability to dismiss the dialog), a custom UI Builder / Now Experience component would need to be developed instead of using the standard g_modal APIs.
Regards,
Balateja