Banner

Embed an iFrame into a Dynamics CRM 2013 form

Back to Blog Listing


To embed an IFRAME with dynamic values to a Dynamics CRM form then first you must create the IFRAME on the relevant form. This can be done by navigating to the "form editor" for the relevant page then selecting to insert an IFRAME.
picture of IFRAME add button

 

Give the IFRAME a name, a label and a URL (please note that at this point the URL value is irrelevant)

new IFRAME window

Create a new JavaScript file with a single function resembling the following. Replacing the relevant URL for that needed to connect to your IFRAME

function begin() {
  
var recordId = Xrm.Page.data.entity.getId();
  
Xrm.Page.ui.controls.get("IFRAME_newframe").setSrc("http://test.com/testpage.aspx?id=" + recordId);
  
}

Add the JavaScript file as a new web resource (from within the customisation options) giving it a name and having it be of type "Script (JScript)"

saving a jscript resource

From the original form editor again you can reference your new resource via the "Form Properties" option on the ribbon bar. Click "add" from the form libraries section and select your newly created JavaScript file

form properties shot

Once referenced, within the event handlers section select "add" again and this time add the name of your function (i.e. "begin" from example above).

new function added on load

Once these steps have been saved and published you should be able to call your custom code with a additional query parameter of the ID of the chosen entity and then display the result on the entity form.


25 Aug 2014

About the Author

James CTwo is our blogging alter ego for the Dynamics CRM and Web experts here at C2. We have a passion for anything CRM, Web Design or Social Media. We love writing about it! Find us on YouTube & Twitter.

comments powered by Disqus

Our White Papers

Discover the content that matters to you on business transformation. Explore how you can drive customer engagement, empower your team, optimise your businesses and revolutionise your products with the next digital revolution. For more information visit our white paper library.

Library

C2 Newsletter

Our newsletter is sent on a quarterly basis, offering detailed insights into all aspects of business transformation with Microsoft cloud technologies. We also promote upcoming events and special offers throughout the year. Sign up to get involved today.

Dynamics 365 Office 365 Power BI Silver Partner