Quantcast
Channel: Microsoft Dynamics 365 Community
Viewing all articles
Browse latest Browse all 13977

Dynamics CRM – Specialized Operations

$
0
0

Specialized Operations were introduced in Dynamics CRM 2015 Online Update 1 and now included in Dynamics CRM 2016 as well.  They provide the ability to do what used to take separate messages (such as Assign or SetState) all in a single Update message. 

The following is the list of special messages that can now be executed in a single Update message:

  • AssignRequest
  • SetStateRequest
  • SetParentSystemUserRequest
  • SetParentTeamRequst
  • SetParentBusinessUnitRequest
  • SetBusinessEquipmentRequest
  • SetBusinessSystemUserRequest

Let’s jump into some sample code.  Before CRM 2015 Online Update 1, this is what it would look like to make an update to a record and then assign it to a different owner.

    var update = new Entity("contact");
    update.Id = contactId;
    update["firstname"] = "Blake";
   
    orgService.Update(update);
   
    var assignRequest = new AssignRequest();
    assignRequest.Assignee = new EntityReference("systemuser", ownerId));
    assignRequest.Target = new EntityReference("contact", contactId);

    orgService.Execute(assignRequest);

As you can see, both the Update message and the Assign message need to be executed.

Now with CRM 2015 Online Update 1 and now CRM 2016, the Assign message can be merged into the Update message and save an extra round-trip to CRM as shown below.

    var update = new Entity("contact");
    update.Id = contactId;
    update["ownerid"] = new EntityReference("systemuser", ownerId));
    update["firstname"] = "Blake";

    orgService.Update(update);

This new feature also has an impact for plug-ins and workflows.  If you perform an Update message that contains the Owner field then any workflow or plug-ins that are registered on Update will trigger once for all non-owner fields and then again for the owner fields.  The same goes when updating state or status fields.


Viewing all articles
Browse latest Browse all 13977

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>