
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;
} Hi,
Since the code snippet you provided are about the exceptions and other handling after the connection instead of the connection itself, it is difficult to pinpoint the problem.
I searched the keyword and found an article which may help you:
Most of the similar issues are caused by the support to TLS 1.2 in Visual Studio 2015. You may check your code to find out if you have the same problem.
If this helped you, I'd appreciate it if you'd mark this as a Verified Answer, which may in turn help others as well.
Best Regards,
Nya