Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

NullReferenceException Error While RetrieveEntityResponse

(0) ShareShare
ReportReport
Posted on by 2,622

Hello EveryOne,

I was trying to get all Associated Enitity with below code but receiving error. 

CrmServiceClient Con = CrmHelper.CrmConnection(textBox6.Text, textBox7.Text, textBox2.Text, textBox3.Text);
             RetrieveEntityRequest retrieveBankAccountEntityRequest = new RetrieveEntityRequest
            {
                EntityFilters = EntityFilters.Relationships,
                LogicalName = textBox5.Text
            };
            RetrieveEntityResponse retrieveBankAccountEntityResponse = (RetrieveEntityResponse)Con.Execute(retrieveBankAccountEn

An unhandled exception of type 'System.NullReferenceException' occurred in Microsoft.Xrm.Tooling.Connector.dll

Additional information: Object reference not set to an instance of an object.

*This post is locked for comments

  • Waqar Sohail Profile Picture
    Waqar Sohail on at
    RE: NullReferenceException Error While RetrieveEntityResponse

    Dear Vikas,

    We are glad your issue get resolved, Please marked it as Verified for others help.

    Thanks.

  • Verified answer
    Vikas Gupta Profile Picture
    Vikas Gupta 2,622 on at
    RE: NullReferenceException Error While RetrieveEntityResponse

    Hello Everyone,

    Problem solved.

    It was the issue with connection string. i have setup my CRM with HTTPS and due to that organization services were deployed on HTTPS. i changed the setup and CRM is running on HTTP. now the code is working fine.

    Thanks everyone.

  • Suggested answer
    prt33k Profile Picture
    prt33k 6,907 on at
    RE: NullReferenceException Error While RetrieveEntityResponse

    The query appears fine.

    Most probably the textBox5.Text need to be trimmed or the connection object need to be reinitialized.

    You can also try using EntityFilters.All and see id that works.

    Prateek

  • Waqar Sohail Profile Picture
    Waqar Sohail on at
    RE: NullReferenceException Error While RetrieveEntityResponse

    Please Verify your Service Connection is not null.  Your Query is fine, you  have verify about CRM Connection and The Textbox values.

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,492 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,305 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans