- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2024 02:43 AM
I’ve created a catalog item in ServiceNow where, when an end user attaches a file, a catalog script is triggered that opens a modal with an external website (in an iframe). However, I keep encountering a "Page Not Found" error.
Here’s what I’ve done so far:
- Created a catalog script that triggers on attachment.
- Used a modal to display the URL.
But for some reason, the page doesn’t load correctly and shows "The page you are looking for could not be found."
Here is the script I am using:
function onChange(control, oldValue, newValue, isLoading) {
// Check if the form is still loading or if the field is empty
if (isLoading || newValue === '') {
return; // Do nothing if the form is still loading or no file is attached
}
alert("I have been called");
// Create the modal with the specified URL once the document is added
var iframeUrl = 'https://www.example.com/';
var dialog = new GlideModal("custom_dialog");
dialog.setTitle("Document Added Successfully");
dialog.setBody("<iframe src='" + iframeUrl + "' style='width:100%; height:400px;'></iframe>");
dialog.render(); // Show the modal
}
What I’ve Tried:
- Checked the URL for typos.
- Looked into iframe restrictions, such as the X-Frame-Options header for the external website that part is good. I belive the restriction is in ServiceNow side.
- I have already looked into the glide.set_x_frame_options property set it to false, and it doesn't solve the issue.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2024 10:45 PM
I think you have to call the modal as follows - then the iframe will be displayed correctly:
var iframeUrl = 'https://www.example.com/';
var htmlData = ("<iframe src='" + iframeUrl + "' style='width:100%; height:400px;'></iframe>");
var dialog = new GlideModal("custom_dialog");
dialog.setTitle("Document Added Successfully");
dialog.renderWithContent(htmlData);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2024 10:45 PM
I think you have to call the modal as follows - then the iframe will be displayed correctly:
var iframeUrl = 'https://www.example.com/';
var htmlData = ("<iframe src='" + iframeUrl + "' style='width:100%; height:400px;'></iframe>");
var dialog = new GlideModal("custom_dialog");
dialog.setTitle("Document Added Successfully");
dialog.renderWithContent(htmlData);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2024 06:56 AM
Thank you @Dennis Braun it worked.