Embedding iframe within a form

Larry Vandiford
Tera Contributor

I'm trying to figure out how to add an iframe to a form.   Specifically, we're trying to add a link to an incident form that will allow a user to click the URL to open a frame with our internal link embedded within.   It seems that we can add a URL (without iframes) simply by adding a URL field.   However, we're not sure how to make that link a frame within the existing form on the browser display, rather than having it simply re-route the engineer to a new page.

Has anyone tried this before and determined how to do it, or if it's even possible?   Thanks in advance!

4 REPLIES 4

Brad Tilton
ServiceNow Employee
ServiceNow Employee

You could do this with a formatter and ui macro combination and then populate the url of the iframe contained in the macro through a client script. Creating it could get pretty complex, and then you have to worry about having scrollbars on the iframe so you can see all of the content.



I would strongly recommend you stick to opening the the link in a new tab/window rather than try to script an iframe on the page.


Thanks.   We may give that a shot since our stakeholders have said that it's critical to have it embedded within the form.   If we can't make it work and look clean on the form, then we'll have to go back to the business and have them reassess the criticality of the request.


To add to Brad's answer, you could also open a GlideDialogWindow with the link and pass the url into a frame on the GDW.   This is a bit of a compromise between the embedded on the form and popping up a new window.



I definitely agree with Brad's recommendation.   It might even be best to just let the browser handle the link.   Letting the browser handle it allows the user decide whether to open it in the current frame (replacing the form), new tab, or new window.


jamesmcwhinney
Giga Guru

I was able to use a formatter + UI macro to create an iframe which does the job.


I was also able to use the GlideDialogWIndow to create a popup of the required form, but I haven't yet found a way to actually embed the form.



Did you have any luck finding a way to embed a form into another form?



Thanks