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 / Business Rules for Ifr...
Power Apps
Answered

Business Rules for Iframes in Model Driven Forms

(0) ShareShare
ReportReport
Posted on by 75

Hello all, 

 

I was wondering if there is a way show or hide iframes in a model driven form using business rules? I have read on this page that it is possible https://docs.microsoft.com/en-us/powerapps/maker/model-driven-apps/visibility-options-legacy but cannot seem to find it. If someone can point me to the right direction.

 

Thanks!

Categories:
  • Verified answer
    v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @xyvic ,

    Could you please share a bit more about your scenario?

    Do you want to show or hide a Iframe component within your Model-Driven form using Business Rules?

     

    If you want to use Business Rules to show or hide a Iframe component within your Model-Driven form, I afraid that there is no way to achieve your needs in PowerApps currently.

    Currently, the Business Rules could only be used to show or hide a field in a Edit form. There is no way to choose the Iframe component in a Model-Driven form using Business Rules.

     

    As an alternative solution, I think custom JavaScript web resource could achieve your needs. You could consider create a custom JavaScript file, within this js file, specify a proper function within it similar as below:

    function ShowOrHideIframe(){
     // Specify confition
     if(.....){
     Xrm.Page.getControl("iframe").setVisible(true)
     }else{
     Xrm.Page.getControl("iframe").setVisible(false)
     }
     
    }

    Then upload the above JS file into your current solution as Web resources. After that, edit your Entity Form in classic mode, then double-click the Iframe component, then bind the ShowOrHideIframe function from above JS file as event.

     

    Please check and see if the following videos would help in your scenario:

    https://www.youtube.com/watch?v=cdxotlD26EM

    https://www.youtube.com/watch?v=E8EXlRBTL2Y

     

    Best regards,

  • xyvic Profile Picture
    75 on at

    Thanks so much, this is exactly what I was looking for!

  • xyvic Profile Picture
    75 on at

    One last question, I have a function which will show the iframe if my diagnosis field has value of Potential Guest. The diagnosis field is a lookup to another entity. The code below is not working as I have intended. Is there something I have missed in the code?

     

    function showReservationFrame() {
    var diagnosis = Xrm.Page.getAttribute("cr96d_diagnosis").getValue();
    if(diagnosis){
    var da = diagnosis;
    } else{
    da = {"name": ""};
    }
    var showIframe;
    if (da.name = "Potential Guest"){
    showIframe = true;
    }else{
    showIframe = false;
    }
    Xrm.Page.getControl("IFRAME_bin3").setVisible(showIframe);
    }

     

     

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 Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 234 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 207 Most Valuable Professional

#3
timl Profile Picture

timl 122 Super User 2026 Season 2

Last 30 days Overall leaderboard