How to Use HTML Web Resource in Dynamics CRM

How to Use HTML Web Resource in Dynamics CRM

HTML Web Resources are one of the most powerful customization options available in Dynamics CRM and Dynamics 365. They allow developers to create custom user interfaces using HTML, CSS, and JavaScript and embed them directly into forms, dashboards, and applications.

By using HTML Web Resources, organizations can extend standard Dynamics 365 functionality and deliver richer user experiences tailored to their business requirements.

What is an HTML Web Resource?

An HTML Web Resource is a custom HTML page stored inside Dynamics CRM that can contain HTML, CSS, JavaScript, images, and external libraries.

Benefits of HTML Web Resources

Create an HTML Web Resource

  1. Navigate to Solutions.
  2. Select Web Resources.
  3. Click New.
  4. Enter a unique Name.
  5. Select Type as HTML.
  6. Upload your HTML file.
  7. Save and Publish.
Sample HTML Web Resource:
<html>
<body>
    <h2>Welcome to Dynamics 365</h2>
    <button onclick="alert('Hello CRM')">
        Click Me
    </button>
</body>
</html>

Add HTML Web Resource to a Form

  1. Open the desired form.
  2. Select a tab or section.
  3. Insert a Web Resource component.
  4. Select the HTML Web Resource.
  5. Configure display settings.
  6. Save and Publish the form.

Pass Data to HTML Web Resource

Parameters can be passed from Dynamics 365 forms to HTML Web Resources using query string parameters and JavaScript.

var recordId = Xrm.Page.data.entity.getId();

The record information can then be used inside the HTML page for custom processing.

Important: Avoid using deprecated Xrm.Page methods in new implementations. Use formContext whenever possible.

Common Use Cases

Best Practices

Key Takeaways