How to open a lookup record within the same parent page in Dynamics 365 CRM using sidePane feature.

Recently I was looking for updates introduced in Dynamics 365 and came to know about sidePanes (I know, I am quite late :\), so I thought to open the lookup record within same parent page record i.e. If I click on "Parent Account" lookup field on a contact form then view the account record on the same contact page without navigating to any other page or tab or window.

So, we can achieve this by following below line of codes in our JavaScript:

function ExpandSidePane(executionContext) {
    var formContext = executionContext.getFormContext();
    var title = formContext.getAttribute("name").getValue();
                                formContext.getControl("parentaccountid").addOnLookupTagClick(function (e) {
        e.getEventArgs().preventDefault();
        var lookupRecord = e.getEventArgs().getTagValue().id;
        //Using sidePanes client API reference.
        Xrm.App.sidePanes.createPane({
            title: title,
            imageSrc: "",
            hideHeader: false,
            canClose: true,
            width: 600
        }).then((pane) => {
            pane.navigate({
                pageType: "entityrecord",
                entityName: "account", // Entity Schema Name
                entityId: lookupRecord, // Entity record GUID.
            })
        });
    });
}

OUTPUT:



Comments

Popular posts from this blog

Search data in Gridview on Textbox Key press event using JQuery in Asp.Net- C#

StateCode and StatusCode Values for mostly used entities in Microsoft Dynamics CRM 2013

Dumps for Microsoft Dynamics CRM MB2-703 Practice Exam Questions Free

How to import CSV files into DataTable in C#

How to show enlarge image when mouse hover on image or link in Asp.Net(c#) using JavaScript

go to top image