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)

We are not able to pass input parameters to html web-resource from entity form.

(0) ShareShare
ReportReport
Posted on by

Requirement:

We would like to open and pass input parameters to an HTML web-resource in CRM Modal Dialog box after user clicks on a custom ribbon button on the entity Form. HTML web-resource will, in turn, call external URL using form “post” method. External URL will fetch data using input parameters and display the result in CRM Modal dialog box.

 

Problem Statement:

We are not able to pass input parameters to html web-resource from entity form.

 

*This post is locked for comments

I have the same question (0)
  • Royal King Profile Picture
    27,686 on at

    Are you calling any javascript function to open modal dialogue? if so you can easily pass record values as query string parameter to the Dialogue window.

    find below sample code to pass multiple values

    var customParameters = encodeURIComponent("first=First Value&second=Second Value&third=Third Value");

    Xrm.Utility.openWebResource("new_webResource.htm",customParameters);

    detailed information on passing multiple values to web resouce can be found here

    msdn.microsoft.com/.../jj602956.aspx

  • MarkR_B Profile Picture
    465 on at

    Nitinsha

    You can easily open a dialog with the following code

    var currentRecId = window.parent.Xrm.Page.data.entity.getId();
    var someText = "info";
    var addParams = "recordid=" + currentRecId + "&sometext=" + someText;
    //Build the URI
    var src = "/webresources/new_customDialog.htm?Data=" + encodeURIComponent(addParams);
    //Build dialog options
    var DialogOptions = new Xrm.DialogOptions();
    DialogOptions.width = 1300;
    DialogOptions.height = 850;
    
    Xrm.Internal.openDialog(src, DialogOptions, null, null, CallbackFunction);
    //Execute some action on closing of dialog
    function CallbackFunction(returnValue) {
      //Do something with the returned value
    }

    Then within the dialog you can use the following function to get the parameters.

    function ParseQueryString(query) {
      var result = {};
      if (typeof query == "undefined" || query == null) {
         return result;
      }      
      var queryparts = query.split("&");  
      for (var i = 0; i < queryparts.length; i++) {
         var params = queryparts[i].split("=");
         result[params[0]] = params.length > 1 ? params[1] : null;
      }
      return result;
    }

    Then to get the parameters use the function as such

    //Get the parameters passed
    var passedparams = ParseQueryString(GetGlobalContext().getQueryStringParameters()["Data"]);
    
    //Populate the property ID
    var currentRecId = passedparams.recordid;
    var someText= passedparams.sometext;

    One thing to note, you will run into cross domain issues if you are obtaining data from a seperate domain. Take a look at this thread it may be of use to you https://community.dynamics.com/crm/f/117/t/137165.aspx. I have used Actions to owvercome this and it works well.

    Hope this helps 

    Mark

  • Ritesh.ar Profile Picture
    5 on at

    Thanks Mark , It is a perfect solution.

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!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans