Business Rules, Calculated Fields and Workflows – What one should I choose?
Lets look at the scenario where we have the ‘forecast’ field on the opportunity which is ‘calculated’ with the formula (Est. Revenue * Probability) /100
- When you create the field – Forecast you create it as a calculated cell and put the formula in the action
- You create forecast as a standard field and then you create a workflow to create the calculation
- You create forecast as a standard field and then you apply a business rule to create the calculation
- You could use code
All 3 methods can work and for an experienced person would take similar amounts of time to create. What one should you choose? Let’s quickly go through each of the non code methods and then you may be able to decide.
So we can compare ‘side by side’ I will create 3 new fields and put them on the form – I have created them all as currency fields
I am also going to make both the Est. Revenue and the Probability mandatory fields, there is no point having rules and calculations in place if people don’t populate with data.
If I chose this I would do the following.
I will create a field called forecast calculate with the data type currency fields and the field type calculated. In the calculation I choose to input my formula and I am done.
When I choose I will create a field called forecast workflow to use for this method with the data type currency fields and the field type simple
I am creating the workflow to run on creation or if either probability or Est. Revenue changes and to run real time
The workflow will be in 3 steps.
- Populate forecast with the value from Est. revenue
- Multiply by the Probability
- Divide by 100 – although as there isn’t a division as an operator multiplying by 0.01 will have the same effect (note: if you have the field as whole number this will not work)
- Save and activate the workflow
If i choose this I will create a field called forecast br to use for this method with the data type currency fields and the field type simple
Create the business rule and set the scope to run on all forms
Create the condition to check if the Est. Revenue field contains data
If it does create the action to preform the calculation
You then need a second action to divide by 100
I have also put in an action to set the value to zero if there is nothing in the est revenue
Your rule is now complete – save and activate the rule
After you have published all your changes open an opportunity and check to see if the different methods all work
As soon as you click on save everything should update
For the formula we had in this scenario I personally would favour the calculated cell as I think it is neater as we had the 3rd step to divide by 100 but all work so it is personal choice. There are a lot of thing you can do with both calculated cells and business rules which you may previously have done via workflows and code in the past. Next time you need a calculation have a think about the effort and maintenance in each of the methods and see which suits that situation best. So what will you choose?