Hi Guys
I am trying to use linq to perform CRUD actions against
CRM 2011, all retrieves are working great but I am having some issues creating new records. I can successfully create new
ACCOUNT & OPPORTUNITY records but I am unable to create a
CustomerAddress or Contact record, example code can be seen below:
The Exception is:
"EntityState must be set to null, Created (for Create message) or Changed (for Update message)"
Before you ask, yes I have tried setting entity.EntityState = null and entity.EntityState = EntityState.Created
CustomerAddress
newAddress = new
CustomerAddress()
{
Name =
"Test Add",
Line1 =
"Test Line 1",
ParentId =
new
Microsoft.Xrm.Sdk.EntityReference(Contact.EntityLogicalName,
parentRecordId),
Id =
Guid.NewGuid()
};
Any Help would be greatly appreciated, Thanks