Help on iFrame

Abhijit Das7
Tera Expert

Hi Everyone,

 

I am recently introduced to iFrame. My task is to load external URL in ServiceNow console using iFrame in Classic UI and agent workspace. Can anyone guide me to achieve this.

 

cc: @kamlesh kjmar 

 

Thanks in advance

1 ACCEPTED SOLUTION

kamlesh kjmar
Mega Sage
Mega Sage

Hi @Abhijit Das7 ,

 

How you can achieve this depends on where you want your iframe to be embedded. For agent workspace it will not work as agent workspace do not allow such fields to render on form. To know list of field types supported by agen workspace refer to the link provided below:

 

https://docs.servicenow.com/bundle/quebec-servicenow-platform/page/administer/workspace/reference/ag...

 

Now, since you are looking to show this in agent workspace as well, I assume you need this in any form. For this you would require two things:

 

1. UI Macro - To embed the link as an iframe

2. Formatter -  To link with UI Macro and allow to appear on form as a field.

 

You can refer to the steps below:

 

1. Create a UI Macro as shown below. In the below code replace src value with your site URL that you want to embed.

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<iframe src="https://abc.xyz" height="900px" width="1800px"></iframe> 
</j:jelly>

 

kamleshkjmar_0-1669183858349.png

 

 

2. Create a formatter record and attach it with UI Macro created in step 1 and with the table where you want to include this, as shown below:

kamleshkjmar_1-1669183938996.png

 

3. Now include your formatter on your form page by configuring form layout:

 

kamleshkjmar_2-1669184076630.png

 

 

 

Finally your embedded link will appear on the form as an iframe

 

kamleshkjmar_3-1669184119036.png

 

Please note iframe will work only when the url you are trying to embed allows it's site/page to be used as an iframe, otherwise you will get error loading.

 

I hope this helps.

 

Regards,

Kamlesh

 

 

 

View solution in original post

10 REPLIES 10

Aditya007aa
Tera Contributor

I am able to add the above steps & I am able to see the iFrame inside the incident page.

Now i want to auto populate those incident records like Incident Number & Incident Subject when i click on a process button so it auto populates .

 

Or 


I have created a widget with scripts added there but i am able to add that widget in "Home" page only, i want to add that widget in the "Incident" page that will solve my problem.