CRM Crate

Display an entity record within a record using sidePanes in Dynamics 365

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

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 NameTypeRequiredDescription
titlestringNoThe title of the pane. Used in pane header and for tooltip.
panelIdstringNoThe ID of the new pane. If the value is not passed, the ID value is auto-generated.
canCloseBooleanNoWhether the pane header will show a close button or not.
imageSrcstringNoThe path of the icon to show in the panel switcher control.
hideHeaderBooleanNoHides the header pane, including the title and close button. Default value is false.
isSelectedBooleanNoWhen set to false, the created pane is not selected and leaves the existing pane selected. It also does not expand the pane if collapsed.
widthNumberNoThe width of the pane in pixels.
hiddenBooleanNoHides the pane and tab.
alwaysRenderBooleanNoPrevents the pane from unmounting when it is hidden.
keepBadgeOnSelectBooleanNoPrevents 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.

Thus we learned to display an entity record within a record using sidePanes in Dynamics 365.

5 2 votes
Article Rating
Subscribe
Notify of

3 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Understanding and creating Custom Pages in Dynamics 365 - CRM Crate
11 months ago

[…] 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 […]

Open a Custom Page on a button click in model-driven app (Dynamics 365) - CRM Crate
11 months ago

[…] 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 […]

Understanding the addOnLookupTagClick client Web API in Dynamics 365 - CRM Crate
11 months ago

[…] we will use the SidePanes client API to display the lookup’s selected record within the same […]

error: CRM Crate Security Engine - Disabled Right Click & Selection!

Congratulations!

Well Done,
Welcome to CRM Crate

Stay tuned with us and get all latest updates and learning in Microsoft CRM and related techonologes.