locked
CRM 2013 - how to get a returnvalue from a (dialog) html webresource? RRS feed

  • Question

  • Does anyone have a good model for showing an HTML webresource from the ribbon to use as a dialog and returnvalue to calling script? Ideally using callback function

    Thanks

    Monday, April 14, 2014 4:30 PM

All replies

  • Hi,

    You can use a call back mechanism where you use window.opener to reference the opening window and call a function on that window when the child window is closed.

    You could use jquery to create modal dialogs - but this would be highly unsupported/invasive and I'd recommend against it unless you are sure of the total cost of ownership.

    In the CRM2011 I had this solution, maybe you can try on CRM2013

    http://thinkingincrm.blogspot.ch/2013/07/open-html-web-resource-page-in-modal.html


    Alessandro Graps

    Tuesday, April 15, 2014 2:03 PM
  • In your script you could do something like:

    In your script open an html web resource and pass values to it:

    var dialogResults = showModalDialog(Xrm.Page.context.getClientUrl() + "/webresources/yourfile.html", {
            data: "your data to pass to dialog"
        },
            "dialogHeight: 600px; dialogWidth: 800px; center: Yes; resizable: Yes; status: No;");

    In the html page, return values back tot he calling script:

    window.returnValue = ["something"];

    Read the returned values in the calling script:

    var returnValue = dialogResults[0];


    Jason Lattimer
    My Blog -  Follow me on Twitter -  LinkedIn


    Tuesday, April 15, 2014 2:43 PM
    Moderator
  • I'm looking for a cross browser solution that will use an inline dialog if possible?

    Certainly when this is supported in RU3?

    Don't think Chrome supports modal dialog?

    Thanks

    Tuesday, April 15, 2014 3:10 PM