web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Model Driven App Dynam...
Power Apps
Unanswered

Model Driven App Dynamic Iframe

(0) ShareShare
ReportReport
Posted on by 15

Hi All, 

 

Is it possible to create an iframe in a model driven app that has a URL based on a field value in the current record

 

For Example:

 

<Script>

 

VarCustomFieldGUID =  GetRecordCustomFieldValue

IframeUrl = "www.google.co.uk" + VarCustomFieldGUID

 

</Script>

I have the same question (0)
  • Ram Prakash Duraisamy Profile Picture
    5,877 Super User 2026 Season 1 on at

    Hello @SamWhitehouse,

     

     

    You can write Javascript to Dynamically load IFrame using below Javascript in Model Driven app

     

    function OnLoad()  

     {  

          //Get memberid  

          var value = Xrm.Page.getAttribute("new_memberid").getValue();  

          //Get the default URL for the IFRAME, which includes the   

          // query string parameters  

          var IFrame = Xrm.Page.ui.controls.get("IFRAME_NAMEofIFRAME");  

          var Url = IFrame.getSrc();  

          //Append the parameters to the new page URL  

          newTarget = value;

          // Use the setSrc method so that the IFRAME uses the  

          // new page with the existing parameters  

          IFrame.setSrc(newTarget);  

     }

     

     

    Hope this helps. Let me know if you need more help.

     

    Please mark as Answer if it is helpful and provide Kudos


    Subscribe : https://www.youtube.com/channel/UCnGNN3hdlKBOr6PXotskNLA
    Blog : https://microsoftcrmtechie.blogspot.com

  • a33ik Profile Picture
    3,306 Most Valuable Professional on at

    @rampprakash everything is great in your example with one exception - Xrm.Page is in the deprecation list and it will be removed in the future so it's better to recommend using executionContext/clientContext.

  • Zhenya Profile Picture
    123 on at

    I used code example below, based on this doc, Use IFRAME and web resource controls on a form (model-driven apps) - Power Apps | Microsoft Learn

    In my case I have field with link+shipment tracking number and  iframe changes src as using value from that field everytime user open form. 

     

    var Tracking = window.Tracking || {};
    (function () {


    this.formOnLoad = function (executionContext)
    {
    var formContext = executionContext.getFormContext();
    var link = formContext.getAttribute("cr0df_trackinglink").getValue();

    var IFrame = formContext.ui.controls.get("IFRAME_tracking");
    IFrame.setSrc(link);

     

    }

    }).call(Tracking);

  • SW-21100945-0 Profile Picture
    15 on at

    Thanks All, 

     

    It seems like the Iframe is loading but with the Default URL provided. Here are the steps i have completed:

     

    1. Created a new form
    2. Created a new tab
    3. Added the "External Website" Component with a url to www.google (As it requires something as a minumum)SamWhitehouse_0-1670320380727.png

       

    4. Set the below properties 
      1. Name to tracking (Im assuming this is what the Script needs for "IFRAME_tracking")
      2. Ticked the "Pass record object-type code" to yes
    5. Added an event handeler that has the below JS.Code
      var formContext = executionContext.getFormContext();
      var value = formContext.getAttribute("crf77_URL").getValue();
      var newTarget = value;
      //Get the default URL for the IFRAME, which includes the
      // query string parameters
      var IFrame = formContext.ui.controls.get("IFRAME_test");
      var Url = IFrame.getSrc();
      //Append the parameters to the new page URL
      // Use the setSrc method so that the IFRAME uses the
      // new page with the existing parameters
      IFrame.setSrc(newTarget);
    6. SamWhitehouse_2-1670320784213.png

       

       SamWhitehouse_1-1670320543531.png

       

     

    but still no luck 😞 am i doing something wrong?

  • Zhenya Profile Picture
    123 on at

    Maybe try different Events, I am using on Tab change.

    You can try debug with tool below:

    Monitor and troubleshoot model-driven app form behavior in Power Apps - Power Apps | Microsoft Learn

     

     

    Event.PNG

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 421

#2
WarrenBelz Profile Picture

WarrenBelz 345 Most Valuable Professional

#3
Kalathiya Profile Picture

Kalathiya 278 Super User 2026 Season 1

Last 30 days Overall leaderboard