web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Unanswered

How to display different forms switch 2 differents view of Account entity

(0) ShareShare
ReportReport
Posted on by 5

Hi everyone,
I added two pages which displayed 2 differents Account view (grid), using a custom URL (/main.aspx?appid=xxx&pagetype=entitylist&etn=account&viewid=xxx).
When I double-click on an item of the grid, I want to display a custom form for each views so I developed the following script called when Account onLoad event is raised.

function onLoad(executionContext) {
        console.log("############### Account onLoad ###############" );
        _formContext = executionContext.getFormContext();

        var accountId = _formContext.entityReference?.id.replace(/[{}]/g, '');
        var viewId = xxx;

        var parameters = {};
        parameters["entityName"] = "account";
        parameters["entityId"] = accountId;

        switch(viewId) {
            case "d5ad6904-ffd1-ed11-a7c7-002248cb0048":
                parameters["formId"] = "995d836c-ecd2-ed11-a7c7-002248cb0048"; // With times
                Xrm.Navigation.openForm(parameters);
                break;

            case "dff9aa52-00d2-ed11-a7c7-002248cb0048":
                parameters["formId"] = "12078bcf-edd2-ed11-a7c7-002248cb0048"; // Without times
                Xrm.Navigation.openForm(parameters);
                break;

            default:
                break;
        }
    }

The problem is how to pass the good ViewId from the grid to the Account details ?
I tried to edit grid Account and used onRecordSelect event but this event is raised only when the user select the record in the grid and not tried to modify it (double click or Modify in the command bar)

Thanks for your help



pastedimage1680705012717v1.png

I have the same question (0)
  • Oos_bdM Profile Picture
    5 on at

    For interested people, here the solution

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Martin Dráb Profile Picture

Martin Dráb 47 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 38 Super User 2025 Season 2

#3
#ManoVerse Profile Picture

#ManoVerse 31

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans