Deploying custom web applications to Microsoft CRM 2011

Now it's time to deploy our web application to Microsoft CRM 2011. In Microsoft CRM 4.0, we used to deploy custom web applications in the ISV folder, but in Microsoft CRM 2011, calling the Microsoft Dynamics CRM 2011 web services from the <crmwebroot>ISV folder is no longer supported. The ISV folder has officially been deprecated, so any custom code or custom web page deployed in this folder must use only 2007 service endpoints. Let's create a virtual directory for our website under IIS. Perform the following steps to set the virtual directory:

  1. Open Internet Information via Control Panel | Administrative Task | Internet Information Services.
  2. Select Server Name | Sites | Default Web Site.
  3. Right-click on Default Web Site and select Add Application.
  4. Enter the following information:
    1. Alias: FooditemDetails
    2. Physical Path: Select the location for your web project.
    3. Application Pool: Keep it at the default value.
  5. Click on OK.

Once configuration has been done, the website tree should like the following screenshot:

Deploying custom web applications to Microsoft CRM 2011

Now let's access our web application in Microsoft CRM 2011:

  1. Open the Development solution that we created in Chapter 4, Implementing Business Logic through Plugins.
  2. Navigate to Web Resources.
  3. Click on New to create a new web resource.
  4. Enter the following information in the web resource dialog box:
    1. Name: contactWR.js
    2. Display Name: contact
    3. Type: Script (JavaScript)
  5. Open the text editor and enter the following code:
    function ShowCustomWeb()
    {
    var ID=Xrm.Page.data.entity.getId();
    var URL="http://localhost/FoodDetails/FooditemDetails.aspx?id="+ID
    //get iframe
    var IFRAME=Xrm.Page.getControl("IFRAME_fooddetail").setSrc(URL);
    
    }
  6. Click on Save and publish the web resource.

Now we have our web resource ready and need to attach this web resource to the Customer entity. We also need to add the IFRAME in the Customer entity form. Perform the following steps to customize the Customer entity:

  1. Navigate to the Customer entity and open the Customer form to customize it.
  2. Remove Sub-Grid from the Food Details section.
  3. Navigate to the Insert tab from the form ribbon toolbar and select IFRAME:
    Deploying custom web applications to Microsoft CRM 2011
  4. Enter the following information in the IFRAME tab:
    1. Name: IFRAME_fooddetail
    2. URL: #
  5. Uncheck the Restrict cross frame scripting checkbox.
  6. Click on Form Properties in our web resource.
  7. Attach the ShowCustomWeb function to form the OnLoad event:
    Deploying custom web applications to Microsoft CRM 2011
  8. Click on Save to save the changes, and then click on Publish to publish the form.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.2.225