Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

How to pass parameters using openEntityForm

Posted on by 645

I'm trying to open a new form and pass values to use in new form JS code, the new form open but I get a CRM general error, can't find my prob...

I have 2 questions:

1. What am I missing, why do I get an error....?

2. How to get my params in my new from js?

That's my error:

 Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #65B23809Detail: 

My code:

function openNewRec(){  
       var parameters={};
       parameters["gamenumber"] = Xrm.Page.getAttribute("new_gamenum").getValue();
          var windowOptions = {
        openInNewWindow: true
       };
      Xrm.Utility.openEntityForm("new_scores",null,parameters,windowOptions);        
    }

*This post is locked for comments

  • sahara Profile Picture
    sahara 645 on at
    RE: How to pass parameters using openEntityForm

    Well my problem was small but important, must be sure that the field name is the same in the form configuration and in code as well

  • sahara Profile Picture
    sahara 645 on at
    RE: How to pass parameters using openEntityForm

    Goutam the data I pass is a single line of text so I choose in my form cunfiguration in parameters option I choose the safestringtype and gave the parameter the same name like the field and yet it doesn't work

  • gdas Profile Picture
    gdas 50,085 on at
    RE: How to pass parameters using openEntityForm

    okay , what type of field value you are passing ?

    Above code is to assign single line of text.

  • sahara Profile Picture
    sahara 645 on at
    RE: How to pass parameters using openEntityForm

    Hey Bharat yes the field is on the entity (the one that opens the new form)

  • sahara Profile Picture
    sahara 645 on at
    RE: How to pass parameters using openEntityForm

    Hey Goutam, I changes the name now I get this error:

    System.Web.HttpUnhandledException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #8DF36960Detail:

    Don't know what to do..

  • Verified answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: How to pass parameters using openEntityForm

    Hi,

    Make sure you passed correct field name as I can see you have not passed the field name with publisher here  , otherwise your code is correct.

    function openNewRec() {
        var parameters = {};
        var parameter1 = Xrm.Page.getAttribute("new_gamenum").getValue();
        parameters["gamenumber"] = parameter1; // Field Name should be with publisher name like new_gamenum
        var windowOptions = {
            openInNewWindow: true
        };
        Xrm.Utility.openEntityForm("new_scores", null, parameters, windowOptions);
    }


  • sahara Profile Picture
    sahara 645 on at
    RE: How to pass parameters using openEntityForm

    Hey Bahrat , when I'm not passing params it works fine... so maybe the prob is in the new record.. I can't fund it..

  • sahara Profile Picture
    sahara 645 on at
    RE: How to pass parameters using openEntityForm

    I'm using 2016 on-premise

  • Suggested answer
    BharatPremji Profile Picture
    BharatPremji 2,485 on at
    RE: How to pass parameters using openEntityForm

    Apologies,

    Just saw your tag saying your using 2016.

    Can you check this:

    parameters["gamenumber"]

    Is gamenumber the name of the field on the entity new_scores.  

    Have a look at this:

    msdn.microsoft.com/.../jj602956.aspx

  • Suggested answer
    BharatPremji Profile Picture
    BharatPremji 2,485 on at
    RE: How to pass parameters using openEntityForm

    Hi,

    What version of Dynamics are you using?

    If your online and using version 9, you should be using Xrm.Navigation.openForm, have a look at this:

    docs.microsoft.com/.../openform

    Regards

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