Microsoft Dynamics CRM 2015 Update 1 released some new features that will be very help for developers. In this post we will discuss new improvement in Update method. In earlier version we had different request for the special operations for example AssignRequest for changing owner once record is created,SetStateRequest to change the status of entity record. But now with the release of CRM2015 Update 1 we don’t need to use request (they are deprecated). We can simply apply these operation in the update request only.
For example below is the request to update account record and assign it to another user and change status to inactive:
- OrganizationService service=GetCrmService();
-
-
-
- Entity account=new Entity(“account”);
-
-
-
- account[“accounted”]=new Guid(“af393105-2a98-407b-9215-6113f19498ad”);
-
-
-
- account[“ownerid”]=new EntityReference(“systemuser”, new Guid(“af80d7b3-e5e1-4b52-a141-a594f24ee015”);
-
-
-
- account[“statecode”]=new OptionSetValue(1);
-
- account[“statuscode”]=new OptionSetValue(2);
-
-
-
- service.Update(account);
Before:
After: