I have a plug-in that attempts to create a customeraddress record. The parent of the customeraddress is an account. The below returns an exception. Please help!
private static void CreateAddvantageAddress(IOrganizationService service, Guid id) { using (var crm = new XrmServiceContext(service)) { var account = crm.AccountSet.Where( a => a.AccountId == id).First(); var customeraddress = new CustomerAddress { ParentId = account.ToEntityReference(), ObjectTypeCode = "1", AddressTypeCode = 920000001, Name = "AdVantage Address" }; crm.AddObject(customeraddress); crm.SaveChanges(); } }