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

Hello @kamlesh kjmar , 

 

We have requirement to display customized Azure Dashboard in Servicenow Dashboard.

I implemented this solution, added azure dashboard URL in the UI Macro here I'm receiving 'refused to connect'

BinduJayagond_0-1678779665705.png

 

To check whether this is working or not we added https://www.google.com/ url in the UI Macro receiving same refused to connect error. 

BinduJayagond_1-1678779971192.pngBinduJayagond_2-1678779986443.png

Could you please guide me here and let me know what to do in such case.

Thank you.

Hi @Bindu Jayagond.,

 

Sorry I was occupied these days hence couldn't answer on time. In case if you are still searching for answer then below info can help you.

 

You can render only those sites as an iframe which allows itself to be rendered as an iframe. Most of the sites today do not allow to be rendered as iframe. To validate, what you can do is change your iframe src url to "https://abc.xyz" and you will find iframe rendering this page. This is because abc.xyz allows rendering it's site as an iframe.

 

I hope this answers your question. Please hit the Helpful button if this solves your query.

 

Regards,

Kamlesh

 

Hello @kamlesh kjmar ,
I appreciate your answer. Thank you for the help.

Hello @kamlesh kjmar , 

 

We have requirement to display customized Azure Dashboard in Servicenow Dashboard.

I implemented this solution, added azure dashboard URL in the UI Macro here I'm receiving 'refused to connect'

BinduJayagond_0-1678779665705.png

 

To check whether this is working or not we added https://www.google.com/ url in the UI Macro receiving same refused to connect error. 

 

BinduJayagond_0-1678782939768.png

BinduJayagond_1-1678782963421.png

Could you please guide me here and let me know what to do in such case.

Thank you.

 

Michael Gruber
Tera Contributor

What about displaying iframes on Dashboards?