AssignRequest, SetStateRequest, SetParentSystemUserRequest and etc are deprecated in CRM 2015 Update1

No comments


As we all know that we need to use special methods like below for different purposes

  • AssignRequest
  • SetStateRequest
  • SetParentSystemUserRequest
  • SetParentTeamRequest
  • SetParentBusinessUnitRequest
  • SetBusinessEquipmentRequest
  • SetBusinessSystemUserRequest

Some times we may miss/forget and write coding which will not fulfill the requirement or may lead to errors.

But with this Update 1, every thing can be handled in Update request.

using (var service = new OrganizationService(crmConnection))
    Entity account = new Entity("account");
    account["accountid"] = new Guid("0C2D5AC7-B7E4-E411-80E9-C4346BAC7DA8");
    account["name"] = "Adventure Works Inc.";
    account["creditlimit"] = new Money(100000);
    account["statecode"] = new OptionSetValue(1); //inactive
    account["statuscode"] = new OptionSetValue(2); //inactive
    account["ownerid"] = new EntityReference { LogicalName = "team", Id = new Guid("042d5707-6fe5-e411-80e5-fc15b428fa14") };
    var request = new UpdateRequest() { Target = account };
    var response = (UpdateResponse)service.Execute(request);
I like this update personally as it is little straight forward than the special messages.
Thank you,
Sreeni Pavalla

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.