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

Announcements

No record found.

News and Announcements icon
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

    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

    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

    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

    Syed,

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

  • Syed Ibrahim Profile Picture
    6,257 on at

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

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    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

    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

    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

    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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
JS-09031509-0 Profile Picture

JS-09031509-0 3

#2
AS-17030037-0 Profile Picture

AS-17030037-0 2

#2
Mark Eckert Profile Picture

Mark Eckert 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans