Adding Total Invoiced Data To Microsoft Dynamics CRM Account Record

This came up today during our Dynamics SL user group meeting. How can we simply build a marketing list based on total orders? This is a good question as the advanced find is unable to do any math functions. I can pick a specific set of customers based on what specifically they have ordered, but if I want to group or sort customers based on the total amount invoiced, that is going to be a problem.  

A simple workflow and a single custom field can do the trick. Mitch Milam addressed this issue on the CRM team blog a year ago. Here is excerpts from the article that can be read at

http://community.dynamics.com/blogs/crmmitchmilam/comments/10601.aspx

 —————————————————————————————————————————————————————

 If you haven't spent much time reviewing CRM 4.0 workflows, you should.  You can perform some amazing things without ever writing code. Let's perform the exact same steps using CRM 4.0 workflow.

First, we create a workflow based on the Invoice Entity that has the following properties:

Step 1:  Create a Check Condition using the following information:

Step 2:   Add and Update Record step, on the Related Entity Customer (Account):

image

Step 3:  Click the Set Properties button, then set the Total Invoiced Attribute to the following:

Note: Total Invoiced is a custom Money Field.

By using the Increment by Operator, we are able to increment any existing Total Invoiced amount by the amount found in the Invoice's Total Amount field.

Final Step:

Save and Publish this workflow.

Conclusion:

So, is there a difference between these techniques? Not really. Both accomplish the job in a very similar manner but the Workflow solution requires zero code maintenance and a normal user or administrator can create the workflow.

The biggest difference between the two techniques is in the timing of the actual update. Plugins can be executed either Synchronously or Asynchronously.  Workflows function in an asynchronous manner.

The Synchronous operation will modify the data stream as it is being saved to the database, which can introduce a delay in the user's experience, but will provide results back to the user in a quicker fashion.

Asynchronous operations will happen shortly after the data has been saved which will not impact the user, but which may result in a slight delay between the time the user saved the record and when the value will be updated.

If you can live with the time delay, I feel that workflow is the way to go, in most cases.  If you can't, then download the SDK and start working through their examples.

 
Trackbacks
  • No trackbacks exist for this entry.
Comments

Leave a comment

 Enter the above security code (required)

 Name (required)

 Email (will not be published) (required)

 Website

Your comment is 0 characters limited to 3000 characters.