Making Rollup fields worth it!
With therelease of Microsoft Dynamics CRM 2015 came two new awesome functionalities,called Calculated fields and Rollup field.
Calculatedfields are doing different types of calculations within the entity you are working with, and they are set up within the application (without code). They execute on the server side and they work with more or less every data type.
For more info about calculated fields click here
Rollup fields are summarizing and calculating data from child records. You specify the field and the entity that you would like to summarize up data from to the parent record, you can also add filter criteria’s for the records that you want to summarize. Example of methods that you use a lot are Sum, Count, Min and Max.
As an example you could use the rollup up fields to, on the account see what the total actual revenue the last 3 years is (summarized from the opportunities) or how much the total estimated revenue for the specific account is. And it’s all done without code.
Rollup fields disadvantage
I would say that rollup fields are the most powerful and effort saving function of the two ones mentioned above sins you could use it for functionalise that required a lot of code before. However it has one big disadvantage!
It does not do a re-summarization/ Recalculate directly when a new chilled record is added.
The time until the next recalculation is done, can be configured and be set to a minimum of 1 hour.
Editing Rollup fields settings
To do this go into :
Settings – System jobs
Then change the view to Recurring System jobs.
Click on the calculated rollup field system job record that you would like to change the recalculation time on
Click “Actions” and “Modify Recurrence”
And there you got it!
Another way to get the value faster (in the standard functionality) is to go into the specific records form and press the recalculate button on the field.
However there will be a lot of cases where neither of the above mentioned options are enough to fit the customer’s needs.
Customers expect things to happen directly and will never have the understanding that they need to wait one hour in some cases but not in other cases. End users without developer or super user experience can’t know the difference between the different types of fields and they need to know when they can expect what.
When having this in mind the rollup field’s feels a bit limited…..
Conclusion
To give rollup fields the strength wish it gives the impression of having you need to create a small simple plugin. The plugin needs a trigger on create and save, when the field that you wish to summarize up to the parent is changed.
Same code for coping:
public static void trigger(ITracingService tracingService, IOrganizationService service, String EntityName, Guid ObjectGuid, String NameOfField) { CalculateRollupFieldRequest crfr = new CalculateRollupFieldRequest { Target = new EntityReference(EntityName, ObjectGuid), FieldName = NameOfField }; CalculateRollupFieldResponse response = (CalculateRollupFieldResponse)service.Execute(crfr); }
By doing this user will get the live interaction that he or she expects and the problem is solved!
Over and out
/Ted













