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:
To create new Web Resource below are steps:
Click New
Enter Web Resource Name
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:
Click Save and Publish:
Now, We need some JavaScript to open the new page. Create a new Web Resource, this time select webresource type is equal to JScript:
Go to the text editor and enter a function that will open the page:
Xrm.Utility.openWebResource(“Give HTML Page Name we created”);
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:
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.
The workbench will open:
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:
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 Add CRM Parameter –> Click on CRM Parameter
Select Primary Control
Set the Command for recently created Button.
Click Publish.
Pop Up will appear.
Open the Customer Form. The new button will appear in the Ribbon.
Click on OPEN HTML PAGE Button. JavaScript is executed and the web page is Displayed:
Resource: https://www.adyatantech.com/blogs/open-html-page-from-button-with-ribbon-workbench