Dynamics 365 Add HTML Web Resource and JavaScript Button

Leave a comment

In Dynamics 365, we can use Web Resources to add buttons to forms. To do this, go through the following steps. We will do this using Developer Extensions.

First, create a new project:

Right click and add a new HTML Page:

We will call the page JSButton.html:

This creates:

Let’s add some Hello World text and deploy this to see how it looks:

From the Web Resource Deployer, Connect to CRM and select to add a new file:

Enter the information below and press Create:

We will add our new web resource to the Account form.

Set the properties on the new section:

Now add a new Web Resource:

Add the web resource just created:

Add the web resource properties:

It should now look like below. Save and Publish:

Now if we open an Account, we will see the web resource displayed:

Now let’s add some JavaScript:

<button onclick="ButtonClicked()">Submit</button>

Add the command to display Hello World:

function ButtonClicked() {
    alert("Hello World!");
}

Save and Publish. Now refresh

This displays:

 

ABOUT CARL DE SOUZA

Carl de Souza is a developer and architect focusing on Microsoft Dynamics 365, Power BI, Azure, and AI.

carldesouza.comLinkedIn Twitter | YouTube

 

Leave a Reply

Your email address will not be published. Required fields are marked *