Open HTML Page from Button with Ribbon Workbench

1 Comment

There may be a requirement to open an HTML page from a button. In this example, we will use the Ribbon Workbench to open a page from a button.

First, create a new solution and go to Web Resources:

Click New and enter details for the HTML page. Select Type:

Select Type as Webpage and then select Text Editor:

This will open an HTML page:

Selecting the Source tab will show the HTML:

Enter some text and press OK:

Press Save and Publish:

We now need some JavaScript to open the new page. Create a new Web Resource, this time JScript:

Go to the text editor and enter a function that will open the page:

function OpenPage () {
   Xrm.Utility.openWebResource("new_TestHTMLPage.html");
}

Now we will add an entity to our solution that will have the button we are launching this from. Add the account entity:

Save and publish the solution. We can now use the solution in Ribbon Workbench.

Go to Ribbon Workbench:

Select Open Solution:

You may need to press Refresh. Select the resource and click OK:

The workbench will open:

Drag a button from the Toolbox to the Form area:

Rename the button:

Click + to add a command:

Under Actions, select Add Action and JavaScript:

Type the name to look up the resource:

Add the Function Name:

Then set the command just created on the button:

Click Publish:

Open the Account form. The new button will appear in the ribbon:

The JavaScript is called and the web page opened:

 

ABOUT CARL DE SOUZA

Carl de Souza is a developer and architect focusing on Microsoft Dynamics 365, BI, Web, Cloud and Data Science.

carldesouza.comLinkedIn Twitter | YouTube

 

One Response to Open HTML Page from Button with Ribbon Workbench

Leave a Reply

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