Improved update method –Microsoft Dynamics CRM 2015 Update 1

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:

  1. OrganizationService service=GetCrmService();  
  2.   
  3. //Create account object  
  4.   
  5. Entity account=new Entity(“account”);  
  6.   
  7. //set account id  
  8.   
  9. account[“accounted”]=new Guid(“af393105-2a98-407b-9215-6113f19498ad”);  
  10.   
  11. //Assign this record to dev user  
  12.   
  13. account[“ownerid”]=new EntityReference(“systemuser”, new Guid(“af80d7b3-e5e1-4b52-a141-a594f24ee015”);  
  14.   
  15. //set account status to inactive  
  16.   
  17. account[“statecode”]=new OptionSetValue(1);  
  18.   
  19. account[“statuscode”]=new OptionSetValue(2);  
  20.   
  21. //call update method  
  22.   
  23. service.Update(account);  

 

Before: 

 
After: 
 
HIMBAP | Need any help in Microsoft CRM 2015 Development Contact US !! 
Ebook Download
View all
Learn
View all