Skip to main content

Notifications

Microsoft Dynamics 365 | Integration, Dataverse...
Answered

How to display an html webresource in modal form in Unified inerface on-premise v9

Posted on by 10

Hi,

I've searched around trying to find out how I can open an html webresource in a modal form in the unified interface for an on-premise deployment.

I have found Xrm.Navigation.navigateTo but it appears to be only for online implementations.

Does anybody know how this can be achieved for an on-premise deployment?

  • Phil - BNPPRE Profile Picture
    Phil - BNPPRE 10 on at
    RE: How to display an html webresource in modal form in Unified inerface on-premise v9

    Hi Snice,

    I have it working thanks to your help, you really got me out of a whole with this one. And thanks for sharing your solution to the sizing problem, I was thinking I would have to create a new dialog box for each webresource I needed to display, I will try implementing your method this morning.

    Again thanks so much for your help.

  • Snice Profile Picture
    Snice 50 on at
    RE: How to display an html webresource in modal form in Unified inerface on-premise v9

    If you want to have the same size for all the webresources you show, then it's easy you can adjust the rowspan attribute

    7380.pastedimage1619077913737v1.png

    In our case, every webresources has a different size... So the size have to be dynamic according to the IFrame content.

    I didn't find any supported way to do that.

    Here is what I ended to do:

    function onload(e) {
    //...
        fc.ui.controls.get("IFRAME_ModalDialog").setSrc(Xrm.Utility.getGlobalContext().getClientUrl()   "/webresources/"   webresource   "?data="   data);
        
        $("#IFRAME_ModalDialog").ready(function () {
            setTimeout(function(){ resize();}, 300);        
        });
    }
    
    function resize(){
        var webresourceHeight = window.top.$("div[data-id='PopupDialog']").find("div[role='presentation']").first().height();
        window.top.$("#id-473a54c3-4989-4408-9b78-181a0b90d162-1-IFRAME_ModalDialog-webResourceLabelControlWrapper").height(webresourceHeight-35);
    }

    The guid that is in the id part correspond to the FormId

    I spent lot of time on that and didn't find any better solution..

  • Phil - BNPPRE Profile Picture
    Phil - BNPPRE 10 on at
    RE: How to display an html webresource in modal form in Unified inerface on-premise v9

    I have managed to change the dialog hright, but not the Iframe height - How do you do that?

  • Snice Profile Picture
    Snice 50 on at
    RE: How to display an html webresource in modal form in Unified inerface on-premise v9

    Yes you can leave them like that or generate new one, it doesn't matter. Most important is they should be unique.

  • Phil - BNPPRE Profile Picture
    Phil - BNPPRE 10 on at
    RE: How to display an html webresource in modal form in Unified inerface on-premise v9

    The HandlerUniqueID guid's are they all arbitary or have they got to be retrieved from your CRM organization?  

    It seems the blog article has two different ones for PopupDialog.js

  • Snice Profile Picture
    Snice 50 on at
    RE: How to display an html webresource in modal form in Unified inerface on-premise v9

    in case you need to close the popup from your webresource here is the trick:

    $("button[data-id='dialogCloseIconButton']", parent.document).click();

  • Phil - BNPPRE Profile Picture
    Phil - BNPPRE 10 on at
    RE: How to display an html webresource in modal form in Unified inerface on-premise v9

    I'll give it a go and see how I get on - thanks for you help.

  • Snice Profile Picture
    Snice 50 on at
    RE: How to display an html webresource in modal form in Unified inerface on-premise v9

    There is no Next button. It will show only the content of your webresource as the idea behind that is basically a form with an IFrame that will display your webresource.

  • Phil - BNPPRE Profile Picture
    Phil - BNPPRE 10 on at
    RE: How to display an html webresource in modal form in Unified inerface on-premise v9

    Hi Snice,

    Thanks for your quick reply, I did see that post but was a bit confused as to what code belonged in the PopupDialog.js script.

    When you implement this do you get the 'Next' button appearing?

    Thanks

  • Verified answer
    Snice Profile Picture
    Snice 50 on at
    RE: How to display an html webresource in modal form in Unified inerface on-premise v9

    Hi

    I was in exactly in the same situation last week! I used the Dialog Box for that. You can refer to following post

    debajmecrm.com/.../

    I had to fix some sizing problems but globally it's fine.

    Snice

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans