Open subgrid record as a Modal Popup in Dynamics 365

Hi Everyone,

The most awaiting feature Modal popups are availabe in Dynamics 365 now and made our lives easier for many things, we are getting many requirements to open the records as a popup where we have control on the parent record and hence not loosing the changes.

One of the requirement I heard today was opening the record as popup from Subgrid. Initially we thought there is no way but after quick check we are done with the job with the help of the Editable Grids.

Let’s say there is a subgrid of Contacts on Account and whenever user selects the contact record we can make use NavigateTo function and open the selected record as a popup. We just have to put below code on the RecordSelect event of the subgrid.

function onRecordSelect(executionContext) {
    var selectedRecord = executionContext.getFormContext().data.entity;
    var Id = selectedRecord.getId();
    var entityName = selectedRecord.getEntityName();
    var pageInput = {
        pageType: "entityrecord",
        entityName: entityName,
        entityId: Id
    };
    var navigationOptions = {
        target: 2,
        height: { value: 70, unit: "%" },
        width: { value: 70, unit: "%" },
        position: 1
    };
    Xrm.Navigation.navigateTo(pageInput, navigationOptions).then(
        function success() { },
        function error() { }
    );
}

Hope this helps.


Happy 365’ing
Gopinath.

2 thoughts on “Open subgrid record as a Modal Popup in Dynamics 365

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s