Open HTML Page from Button with Ribbon Workbench

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:

HTML1

To create new Web Resource below are steps:

  • Click New

  • Enter Web Resource Name

  • Select Type as Webpage and then select Text Editor:

HTML2

This will open an HTML page:

HTML3

Selecting the Source tab will show the HTML:

HTML4

Enter some text and press OK:

HTML5

Click Save and Publish:

HTML6

Now, We need some JavaScript to open the new page. Create a new Web Resource, this time select webresource type is equal to JScript:

HTML7

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

Xrm.Utility.openWebResource(“Give HTML Page Name we created”);

HTML8

function OpenPage () {

Xrm.Utility.openWebResource(“adyt_TestHTMLPage.html”);

}

Save and Publish the Web Resource.

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

HTML9

Save and publish the solution. We can now use XRM Toolbox for Ribbon Workbench Solution.

If in Your XRM Toolbox Ribbon Workbench solution is not installed, Please Install that solution first.

HTML10

The workbench will open:

HTML11

Select Solution that we want to open and click on OK Button.

After that Solution is Downloaded.

Drag a button from the Toolbox to the Form area:

HTML12

Rename the button:

HTML13

Click + to add a command:

HTML14

Under Actions, select Add Action and JavaScript:

HTML15

Type the name to look up the resource:

HTML16

Add the Function Name:

HTML17

Then Add CRM Parameter –> Click on CRM Parameter

HTML18

Select Primary Control

HTML19

Set the Command for recently created Button.

HTML20

Click Publish.

Pop Up will appear.

HTML21

Open the Customer Form. The new button will appear in the Ribbon.

HTML22

Click on OPEN HTML PAGE Button. JavaScript is executed and the web page is Displayed:

HTML23

Leave a Reply