Here we will learn to use the form panels in Dynamics 365 to display a Web Page. Before we start, make sure to subscribe to CRM Crate so that you stay up-to-date in the field of Dynamics 365.
What are form panels in Microsoft Dynamics 365?
Panels are a convenient feature introduced as a preview feature in the December 2016 update for Dynamics 365 (Kindly refer – https://msdn.microsoft.com/en-us/library/mt790281.aspx). In spite of its availability, this functionality was not completely deployed until version 9.
The panel client API provides a method to display a web page or a URL in the side pane of the Dynamics 365 CE form. We can consider it as an iFrame that is accessible from most locations in the Dynamics 365 . Unlike the iFrame, we can display the Web Page in a more sophisticated way which gets anchored at side of the form screen.
Client API to populate form panel –
Displays the web page represented by a URL in the static area in the side pane, which appears on all pages in the model-driven apps web client.
Xrm.Panel.loadPanel(url, title)
Parameter Name | Type | Required | Description |
---|---|---|---|
url | String | Yes | URL of the page to be loaded in the side pane static area. |
title | String | Yes | Title of the side pane static area. |
Important Note: – This method is supported only for the web client.
JavaScript snippet code for populating form panels –
Use the below script for dynamically populating the form panels in Dynamics 365. In our scenario, we have trigger the given script during the “On-Change” event of form field.
//CRM Crate - JavaScript Snippet
function CallMethod (executionContext) {
//Reading Attribute Value From The Form.
var formContext = executionContext.getFormContext();
var Input = formContext.getAttribute("cc_displaypanel").getValue();
if(Input == true)
{
//Using loanPanel API.
Xrm.Panel.loadPanel("https://www.crmcrate.com/", "CRM Crate");
}
}
Validating the form panels in Dynamics 365 form –
Now lets validate the operation of above deployed JavaScript snippet in the Dynamics 365 form as shown below.
Thus we learned to use the form panels to display a Web URL in Dynamics 365.
[…] Click on the given link to learn more about the loadPanel client API reference – https://www.crmcrate.com/javascript/using-form-panels-in-dynamics-365-to-display-a-web-page/ […]