web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Not Able Update Entity Record using Alternate Key???

(0) ShareShare
ReportReport
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
    2,715 on at

    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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
ScottDurow Profile Picture

ScottDurow 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans