Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Not Able Update Entity Record using Alternate Key???

Posted on by 2,715

Hello All,

          I am trying to update a account record using alternate key by using the following method but i am getting error"The specified key attributes are not a defined key for the  account entity"

1.Create a accountnumber as alternate key for Account Entity and status of the same is showing Active

2.Add the below code to update a account based on the account number "ACT-12345"

// Use alternate key (accountnumber) field to identify an account record
    Entity account = new Entity("account""accountnumber""ACT-12345");
 
    // Set new credit limit;
    account["creditlimit"] = new Money(100000);
 
    // Entity reference using alternate key (emailaddress1) on contact entity
    account["primarycontactid"] = new EntityReference("contact""emailaddress1""joe@duo.com");
 
    UpdateRequest request = new UpdateRequest() { Target = account };
    UpdateResponse response = (UpdateResponse)service.Execute(request);
        But i am getting error while updating it.....

*This post is locked for comments

  • Suggested answer
    Ramakanta Profile Picture
    Ramakanta 2,715 on at
    RE: Not Able Update Entity Record using Alternate Key???

    Thanks Guido for quick reply..i had did a little mistake...in my config file my connection was point to another CRM instance due to which i got the error....

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