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

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Xrm.Internal.openDialog with parameters

(0) ShareShare
ReportReport
Posted on by

Hi, I'm trying to display custom html, I use Xrm.Internal.openDialog function as it displays window pretty, like crm does.

Here's my js:

var DialogOption = new Xrm.DialogOptions;
DialogOption.width = 700;
DialogOption.height = 520;

Xrm.Internal.openDialog("/WebResources/new_closePhoneCall_confirmed.html", DialogOption, null, null, function (returnValue) { alert(returnValue) });


And my html page:

<html>
<head>
    <script src="/WebResources/ClientGlobalContext.js.aspx" type="text/javascript"></script>
    <link rel="stylesheet" type="text/css" href="new_bootstrap.min.css">
    <script>
        function closeDlg() {
            var result = "123";
            Mscrm.Utilities.setReturnValue(result);
            try {
                closeWindow(true); // Close the dialog box
            }
            catch (e) { }
        }

        setParams = function (link, target, action) {
            var form = document.findElemetById("mainF");
            form.action = link;
        }
    </script>
    <style>
        #Close {
            position: absolute;
            bottom: 0px;
        }
    </style>
    <meta charset="utf-8">
</head>
<body style="word-wrap: break-word;">
    
    <div class="jumbotron" style="max-width:500px">
        <div id="mainF" class="container text-center">
            <input id="Close" class="btn btn-primary" type="button" value="Confirm and close" onclick="closeDlg();">
        </div>
    </div>
</body>
</html>


It displays my page just how I want but I need to pass parameters to it - call js function inside or something...

How do I do this?

Passing params inside url like this doesnt work, I get error 500

Xrm.Internal.openDialog("/WebResources/new_closePhoneCall_confirmed.html?param='value'"//... err 500

Passing params inside url like this doesnt work, I get error 500
And also I see parameters 3 and 4 (I have them as nulls) in Xrm.Internal.openDialog() - what are they for? I can't find any description for them

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Community Member Profile Picture
    on at
    RE: Xrm.Internal.openDialog with parameters

    Hi Ivan,

    this page shows the solution to your problem:

    https://msdn.microsoft.com/en-us/library/gg327945.aspx?f=255&MSPPError=-2147217396

    Please let me know if you solve.

    If you found the answer helpful, please mark as Verified 

    Join my network on LinkedIn      Follow me on Twitter 

    Thank You & Best Regards

    Francesco Picchi

    Microsoft Dynamics CRM Consultant, Bologna+Milano, ITALY

    Independent Contractor

    http://www.francescopicchi.com

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at
    RE: Xrm.Internal.openDialog with parameters

    Ivan,

    To pass anything inside through Url you should use data parameter. I have description here - butenko.pro/.../dynamics-crm-2013-step-by-step-creating-dialog-windows

    Also you can check this - butenko.pro/.../microsoft-dynamics-365-v9-0-whats-new-in-clientside-for-devs-besides-xrm-webapi especially last piece of post - about Xrm.Utility.openDialog - it's not available in v8.x but I believe logic regarding passing of dialogArguments plus usage of it inside dialog's window code should work fine (but I haven't checked that).

  • Suggested answer
    Syed Ibrahim Profile Picture
    6,257 on at
    RE: Xrm.Internal.openDialog with parameters

    Pls try to change the method and follow the link

    [View:https://msdn.microsoft.com/en-us/library/gg327945.aspx].

    Hope this helps. If suggestion resolved your query Mark it as verified to close the thread

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at
    RE: Xrm.Internal.openDialog with parameters

    Syed,

    Can you please prove your words regarding deprecation of Xrm.Internal.openDialog?

  • Syed Ibrahim Profile Picture
    6,257 on at
    RE: Xrm.Internal.openDialog with parameters

    Sry Andrew it's just a  typo ..Xrm.Utility.openDialog

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at
    RE: Xrm.Internal.openDialog with parameters

    Ok. Can you please provide prove of Xrm.Utility.openDialog deprecation?

    It's not even documented - how could it be deprecated?

  • Syed Ibrahim Profile Picture
    6,257 on at
    RE: Xrm.Internal.openDialog with parameters

    Andrew I'm trying to say it will not be applicable to 8.x since I have seen this as feature of v9 . Hope you also posted this feature on your blog as well.

    JavaScript

    var dialogUrl = "/WebResources/extreme_/eXtremeDemoDialog.html?id=" + Xrm.Page.data.entity.getId() + "&typename=" + Xrm.Page.data.entity.getEntityName();

    var dialogOptions = {

    height: 500,

    width: 500

    };

    var dialogArguments = {

    stringParameter: "String Value",

    intParameter: 1

    };

    Xrm.Utility.openDialog(dialogUrl, dialogOptions, dialogArguments, null, function(result){

    console.log("Dialog Closed");

    for(var i in result){

    console.log("result." + i + " is equal to " + result[i]);

    }

    });

    var dialogUrl = "/WebResources/extreme_/eXtremeDemoDialog.html?id=" + Xrm.Page.data.entity.getId() + "&typename=" + Xrm.Page.data.entity.getEntityName();

    var dialogOptions = {

    height: 500,

    width: 500

    };

    var dialogArguments = {

    stringParameter: "String Value",

    intParameter: 1

    };

    Xrm.Utility.openDialog(dialogUrl, dialogOptions, dialogArguments, null, function(result){

    console.log("Dialog Closed");

    for(var i in result){

    console.log("result." + i + " is equal to " + result[i]);

    }

    });

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at
    RE: Xrm.Internal.openDialog with parameters

    Syed,

    Deprecated isn't equal to "not implemented" or "not available". And yes, I posted that to my blog and you know this because you reposted here code from my blog.

  • Syed Ibrahim Profile Picture
    6,257 on at
    RE: Xrm.Internal.openDialog with parameters

    Yes Andrew as i said there was some typo and I modified as well. Thanks for understanding and support .Appreciate your help

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Community Member Profile Picture

Community Member 2

#1
UllrSki Profile Picture

UllrSki 2

#3
SC-08081331-0 Profile Picture

SC-08081331-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans