Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Xrm.Navigation.openForm() doesn't work for existing record ?

Posted on by 65

Hello All,


I am working with V9.1 where I observed that Xrm.Navigation.openForm() is not working for an existing record instead I used the deprecated way Xrm.Utility.openEntityForm() then it works as expected.

It is opening the record but all the fields are blank, so I tried the deprecated way then it works. 

var entityFormOptions = {};
entityFormOptions["openInNewWindow"] = true;
entityFormOptions["entityName"] = myEntity;
entityFormOptions["entityId "] = myEntityGuid;
Xrm.Navigation.openForm(entityFormOptions);

Any suggestions?

Thanks,

Indrasheker

*This post is locked for comments

  • Indra Sheker Profile Picture
    Indra Sheker 65 on at
    RE: Xrm.Navigation.openForm() doesn't work for existing record ?

    Thanks mate didn't observe.

  • Suggested answer
    Indra Sheker Profile Picture
    Indra Sheker 65 on at
    RE: Xrm.Navigation.openForm() doesn't work for existing record ?

    Hi Rawish,

    I have tried using successCallBack too but no luck. Also please see the below attached the response from sucessCallBack(id is undefined).

    376862.Capture.PNG

    Thanks,

    Indrasheker

  • Verified answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: Xrm.Navigation.openForm() doesn't work for existing record ?

    Hi,

    You have space in your entityId parameter. So CRM must be opening a new form instead of an existing form. Try this-

    ==========

    var entityFormOptions = {};

    entityFormOptions["openInNewWindow"] = true;

    entityFormOptions["entityName"] = myEntity;

    entityFormOptions["entityId"] = myEntityGuid;

    // Open the form.

    Xrm.Navigation.openForm(entityFormOptions).then(

       function (success) {

           console.log(success);

       },

       function (error) {

           console.log(error);

       });

    ===========

    Hope this helps.

  • Suggested answer
    Seren S Profile Picture
    Seren S 400 on at
    RE: Xrm.Navigation.openForm() doesn't work for existing record ?

    Hi Indra,

    Do you have your return functions at the end of calling .openForm() function.

    function OpenNewEntityForm() {
        var entityFormOptions = {};
        entityFormOptions["entityName"] = "contact";
        entityFormOptions["openInNewWindow"] = true;
    
        // Set default values for the Contact form
        var formParameters = {};
        formParameters["firstname"] = "SEREN";
        formParameters["lastname"] = "SERIFOGLU";
        formParameters["fullname"] = "SEREN SERIFOGLU";
        formParameters["emailaddress1"] = "seren.serifoglu@live.com";
    
        // Open the form.
        Xrm.Navigation.openForm(entityFormOptions, formParameters).then(
            function (success) {
                console.log(success);
            },
            function (error) {
                console.log(error);
            });
    }


    This totally works on with Version 1710 (9.1.0.1658) online / v9.1

    You can try with above sample code. If you need further information about parameters;

    https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-navigation/openform

    Hope it helps.

    Cheers, Seren.

  • Suggested answer
    Rawish Kumar Profile Picture
    Rawish Kumar 13,756 on at
    RE: Xrm.Navigation.openForm() doesn't work for existing record ?

    Hi Indrashekar,

    the code looks fine and should work as suggested here : docs.microsoft.com/.../openform

    the only difference is you are not using a successCallBack function but i believe is option and wont really create issues.

    I would recommend you try to debug the script and see if you have anything in the console?

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,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans