We will learn to display an entity record within a record using sidePanes in Dynamics 365. Before we start, make sure to subscribe to CRM Crate so that you stay up-to-date in field of Dynamics 365.
![Display an entity record within a record using sidePanes in Dynamics 365](https://promx.net/wp-content/uploads/2020/01/dynamics-365-retrieve-activity-party-list-1.png)
Why do we need to display a record within a record in Dynamics 365 form?
Consider a scenario where we need to populate the details of child records on the parent record depending upon the user input. We can achieve this requirement using a quick view form, iFrames and the client API references.
Using sidePanes client API references –
Here we will learn to populate a record within a record using sidePanes client API reference.
Xrm.App.sidePanes.createPane(paneOptions);
Provides all the information to create side panes. We need to pass the entity record information as an object parameter to the client API.
Below are the parameters required for the paneOptions object.
Parameter Name | Type | Required | Description |
---|---|---|---|
title | string | No | The title of the pane. Used in pane header and for tooltip. |
panelId | string | No | The ID of the new pane. If the value is not passed, the ID value is auto-generated. |
canClose | Boolean | No | Whether the pane header will show a close button or not. |
imageSrc | string | No | The path of the icon to show in the panel switcher control. |
hideHeader | Boolean | No | Hides the header pane, including the title and close button. Default value is false. |
isSelected | Boolean | No | When set to false, the created pane is not selected and leaves the existing pane selected. It also does not expand the pane if collapsed. |
width | Number | No | The width of the pane in pixels. |
hidden | Boolean | No | Hides the pane and tab. |
alwaysRender | Boolean | No | Prevents the pane from unmounting when it is hidden. |
keepBadgeOnSelect | Boolean | No | Prevents the badge from getting cleared when the pane becomes selected. |
JavaScript snippet code for display a record within a record –
The below JavaScript function is triggered during the “OnChange” event of a lookup field called “Subscriber”.
//CRM Crate - JavaScript Snippet
function CallMethod (executionContext) {
//Reading Attribute Value From The Form.
var formContext = executionContext.getFormContext();
var Input = formContext.getAttribute("cc_subscriber").getValue() != null ? formContext.getAttribute("cc_subscriber").getValue()[0].id : null;
//Using sidePanes client API reference.
Xrm.App.sidePanes.createPane({
title: "CRM Crate",
imageSrc: "",
hideHeader: false,
canClose: true,
width: 600
}).then((pane) => {
pane.navigate({
pageType: "entityrecord",
entityName: "cc_subscriber", // Entity Schema Name
entityId: Input, // Entity record GUID.
})
});
}
Validate the output in Dynamics 365 CRM –
Once the above code is configured and published, navigate to Dynamics 365 CRM form and validate if a record is displayed within a record as shown below.
![](https://www.crmcrate.com/wp-content/uploads/2021/09/CRMCrate_SidePanes.gif)
Thus we learned to display an entity record within a record using sidePanes in Dynamics 365.
[…] custom page can be used in places such as main area, dialogs, and the new app side pane. This allows scenarios like a pixel perfect landing page with data pulled from across the […]
[…] custom page can be used in places such as main area, dialogs, and the new app side pane. This allows scenarios like a pixel perfect landing page with data pulled from across the […]
[…] we will use the SidePanes client API to display the lookup’s selected record within the same […]