Activate/ Deactivate a record using C# in Dynamics CRM 2011/ 2013/ 2015
In this blog I am going to show how we could Activate/ Deactivate a record in Dynamics CRM using c#. For this we cannot simply activate or deactivate records by simply setting statecode and statuscode in the early bound entity records. To do this, we must use SetStateRequest and SetStateResponse from Microsoft.Crm.Sdk.Proxy assembly. Add all required updated dll referances in your project. Below is the methods separately for Activating & Deactivating a record:: public static void DeactivateRecord (Guid recordId, OrganizationServiceProxy organizationService) { var EntityName = organizationService.Retrieve("EntityName", recordId, new ColumnSet(new[] { "statecode", "statuscode" })); try { if (EntityName != ...