The workflow engine in Microsoft Dynamics CRM is an area I personally spend a ton of time playing with. It is like Jscript was in Version 1.x and 3.0 for me. It has A TON of potential that many people have barely scratched the surface of.
So in working with a customer over the past month, they wanted to track the number of widgets each one of their accounts has at each location. This works well, until they want to be able to run some queries and there is no way to be able to get the total number of widgets per account. How many accounts have brand A of widgets in a quantity of over 200? How many have Brand B?
So that is where workflow comes in. In talking with Jon Goodwin from Microsoft Consulting Services, he showed me a quick and easy way to have workflow create a summary number on a parent entity. So he showed me a quick trick to be able to take quantities from a child entity and using workflow, create a summary of the number of widgets owned.
Step 1. Create Widget Entity. Add a Quantity Owned to Widget Entity. In addition, I also wanted to track by competitor, but that step isn’t used in this example. Then create a field to track number of widgets and type of widget.
Step 2: Create N:1 Relationship Between Widget and Account Entities. (So the Widgets are a Child Record of an Account)
Step 3: Create Summary Field on Account. (To hold how many widgets total you have!)
Step 4: Create Workflow on Widget Entity. You will want the workflow to fire on the create of a Widget as well as the change of the number of widgets.
Add a step with the type of Update Record. Select Account as the Entity to update.
If you are anything like me, you generally close the form assistant. But in this case, we want to leave the form assistant open. We should click on the Total Number of Widgets, Make the Operator Increment By, and Look for Widget and Number of Widgets. In the Default Value, we put a 0 so that if the user creates the entity and doesn’t fill it in, it doesn’t inflate the total count.
Save and Close the Workflow and Publish it.
So here is the finished product:
And if I browse to Widgets, you can see that we do in fact have 1011 widgets in this location for this customer.
So there is one more way that Workflow can make CRM work better for your customers. Attached is the workflow rule if you want to play with in your demo or testing environment.