Does anybody have example code for AfterPrimaryImport code. I want to perform CRUD on entity rows. I cannot find a way to get the Organization Service that is not null.
With the following code I get error thrown, the CrmSvc is OK but the CrmSvc.OrganizationServiceProxy is null.
Is there another way to get the service? The service I have declared below has all the functions I need, Update, Delete, Execute,.. and compiles.
public override bool AfterPrimaryImport() { if (CrmSvc == null) throw new Exception("CrmSvc is null"); if (CrmSvc.OrganizationServiceProxy == null) throw new Exception("CrmSvc.OrganizationServiceProxy is null"); var service = CrmSvc.OrganizationServiceProxy; Entity entity = new Entity("contact"); entity.Id = new Guid("e8f466d4-64ff-ea11-a815-000d3a3ab828"); entity.Attributes["lastname"] = "Smith"; service.Create(entity); return true; }