Open HTML Page from Button with Ribbon Workbench

2 Comments

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:

 

THANKS FOR READING. BEFORE YOU LEAVE, I NEED YOUR HELP.
 

I AM SPENDING MORE TIME THESE DAYS CREATING YOUTUBE VIDEOS TO HELP PEOPLE LEARN THE MICROSOFT POWER PLATFORM.

IF YOU WOULD LIKE TO SEE HOW I BUILD APPS, OR FIND SOMETHING USEFUL READING MY BLOG, I WOULD REALLY APPRECIATE YOU SUBSCRIBING TO MY YOUTUBE CHANNEL.

THANK YOU, AND LET'S KEEP LEARNING TOGETHER.

CARL

https://www.youtube.com/carldesouza

 

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

 

2 Responses to Open HTML Page from Button with Ribbon Workbench

    • It gave your error because your function is like this:
      function Openweresource() {
      //alert(“function called”);
      Xrm.Utility.openWebResource(“new_webpagename.html”);
      }
      the correct solution will be not add the .html.

      correct solution is like:
      function Openweresource() {
      //alert(“function called”);
      Xrm.Utility.openWebResource(“ssc_Account_Wastecarrrier”);
      }

Leave a Reply

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