Try our conversational search powered by Generative AI!

How to update existing CustomerContact in Commerce?


How to update existing CustomerContact in Commerce? We have UpdateContactAddress and UpdateCreditCard. But i want to update firstname, Lastname etc in CustomerContact..

Edited, Apr 10, 2019 7:09

You can just set those properties directly then call .SaveChanges to persist them

Apr 10, 2019 7:50

When I call SaveChanges , I am getting the error below.

Violation of PRIMARY KEY constraint 'PK__cls_Addr__091C2AFB0A47054F'. Cannot insert duplicate key in object 'dbo.cls_Address'. The duplicate key value is (9ddf0897-569d-49f5-ad42-9431798187be)

Apr 10, 2019 8:20

How does your code look like?

Apr 10, 2019 8:26

Ok I fixed it by removing the line below. I think AddContactAddress tries to create new one while saving. SaveChanges works. Thanks.

Apr 10, 2019 9:11
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.