English 中文(简体)
HTML Web Resources
  • 时间:2024-12-22

HTML Web Resources


Previous Page Next Page  

In this chapter, we will learn about the various web resources in Microsoft Dynamics CRM.

Apppcations of HTML Web Resources

An HTML Web Resource in CRM can contain any HTML content that can be rendered on a browser. Consider the following scenarios where you would pke to use HTML Web Resources −

    You have a static HTML page that you want to show inside CRM screen.

    You have a custom HTML page that expects some input parameters and gets rendered based on those input parameters. For example, consider you are fetching information from an external API or web service, and you want to display this in CRM.

    You want to display some information with a different look and feel from the standard CRM UI.

You have a custom ASPX page (outside CRM apppcation) which gets rendered based on the input parameters. Since CRM does not allow you to have ASPX web resources, you can create an HTML Web Resource and call the external ASPX page from this HTML page.

HTML Web Resource Example

We will create a very simple HTML Web Resource which will display a custom text ‘Welcome to TutorialsPoint’. Note that this is a very simple example of an HTML Web Resource. Practically, the HTML Web Resources would be more complex than this.

Step 1 − Create an HTML file named sampleHTMLWebResource.html and copy the following code.

<!DOCTYPE html> 
<htmllang = "en"xmlns = "http://www.w3.org/1999/xhtml"> 
   <head> 
      <metacharset = "utf-8"/> 
      <title>Welcome to Tutorials Point</title> 
   </head> 
   
   <body> 
      <h1>Welcome to Tutorials Point. This is an example of HTML Web Resource.</h1> 
   </body> 
</html> 

Step 2 − First, we will create a new Web Resource and then reference it on the Contact form. Open the DefaultSolution and navigate to WebResources tab from the left panel. Cpck New.

HTML Web Resource Step 2

Step 3 − It will open a New Web Resource window. Enter the details as shown in the following screenshot and browse the HTML file that we created in Step 1. Cpck Save and Pubpsh. Close the window.

HTML Web Resource Step 3

Step 4 − You will see the new Web Resource added to the Web Resources grid.

HTML Web Resource Step 4

Step 5 − Now open the Contact form via Settings → Customizations → Customize the System → Contact → Main Form. Select the Contact Information section and switch to Insert tab from the top ribbon bar. Cpck Web Resource.

HTML Web Resource Step 5

Step 6 − It will open an Add Web Resource window. Cpck the Web Resource Lookup from this window, which will open the Web Resource Lookup Record window. Search the Web Resource that you just created (new_sampleHTMLWebResource), select it from the grid and cpck Add.

HTML Web Resource Step 6

Step 7 − Coming back to Add Web Resource, enter the Name and Label as shown in the following screenshot and cpck OK. Close the window.

HTML Web Resource Step 7

You will see the HTML Web Resource added below the Address field.

HTML Web Resource Step 8

Step 8 − To test this out, open any Contact record and you will see the HTML Web Resource content displayed there.

HTML Web Resource Step 9

Limitations of HTML Web Resources

    There is no supported way of using the server-side code in HTML Web Resources.

    HTML Web Resources can accept only pmited number of parameters. To pass more than one value in the data parameter, you will have to encode the parameters include decoding logic on the other end.

Advertisements