Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Suggested answer

Setting Default Main Form does not work

Posted on by Microsoft Employee

It seems that I am not able to set the Main Form for an entity in my Model Driven App,

So I have two entities

 

Entity1 and Entity2

 

Entity1 contains a lookup for Entity2 and there is a 1 to N relationship between the two.

 

For Entity2 I have two main forms:

 

  1. Information: Is (should be) the default one and is used to crate or edit the Entity2 records.
  2. History: Is a form containing a subgrid of related Entity1 records.

 

When in the Entity1 form I have a button that should be able to call the second Entity2  form using

 Xrm.Navigation.openForm({
                    entityName: "Entity2",
                    entityId: Entity2_ID,
                    formId: formID
                }, parameters);
            

This seems to be working, however when I access the Entity2 from the SItemap and try to access the main form, I always get the second form.

I tried to ensure the forms are in the correct order from Entity -> Forms -> Forms Order and indeed, the first one is the Information form.  I even tried removing the Form from the list of forms in the App Designer and I am still getting the History form as default when working on the app.

tried opening new browsers to exclude session issues.

what is going on?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Setting Default Main Form does not work

    Hi MarkDeg,

    I'm glad your problem has been solved, the original default form may have flow or plug-in, which result in it.

    Regards,

    Leah Ju

    Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums.

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Setting Default Main Form does not work

    Thanks for your reply. As i mentioned, my issue was not caching or session related as I had already tried opening a new browser.

    However manged to get it to work, simply by creating a new main default form, and now it is working as expected!

    i guess the default main form was somehow not working properly. no idea why, but glad i found it.

    thanks again

    Mark

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Setting Default Main Form does not work

    Hi MarkDeg,

    I have try to set form order and add following Js code to the form, and it open history form (not default form) successfully.

    Then I access entity from site map, it open Information form(default).

    pastedimage1598516921686v2.png

    function testopenform()
    {
    var entityFormOptions = {};
    entityFormOptions["entityName"] = "new_aidefault";
    entityFormOptions["formId"] = "c7e00672-70c1-4a2d-a940-02d387ee0f56";
    entityFormOptions["entityId"] = "0b06bbd5-06dd-ea11-a813-000d3a56957f";
     
    // Open the form.
    Xrm.Navigation.openForm(entityFormOptions).then(
        function (success) {
            console.log(success);
        },
        function (error) {
            console.log(error);
        });
    }

    As you mentioned, you can access history from when you have deleted it, it seems a caching issue, Clear the cache of the browser or use private mode in browser.

    Regards,

    Leah Ju

    Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans