D365 : IFrames with a dynamic source

Today we will talk about IFrames , well you must be wondering :

What are IFrames in CRM ?

IFrames are used to embed the content from other external location in pages with help of html Iframe element. Websites allow us to extend various functionalities and bring information into Microsoft Dynamics 365. By being connected with these websites, we can bring together different web components while also offering extended solutions to our users.

How to add an IFrame with a dynamic source in CRM ?

To add IFrames we go to the form of the enitity we want our IFrame to be, after opening the form we select the wanted tab on the form then on the ribbon bar we click on the insert tab and under section controls we click the IFRAME button and now our new Iframe is added 

After creating the IFrame lets create the field which will hold the link we want to open in the IFrame , go to the same entity we have our IFrame and create a new field of type “single line of text” and of format “URL” , as shown below :

Now we create the JavaScript WebResource which will open the link we put in the created Link field and load that link in our IFrame , the used code (explained with comments) is shown below :

The end result is as shown below :

Firstly we put a link inside our Link field , in this example I’ve used a youtube link.

And as you can see inside our Iframe we have the youtube video that the above link opens.