Aggregate Model Lookup

I worked to mock this up with standard Salesforce fields, and there are a few gotchas to look for.

First, your aggregate model should be higher up in the list of models than the Case model, so that when the Case model’s UI-only field looks for the sum, the sum has already been computed and is ready to be pulled into your formula field.

Next, make sure your MODEL_LOOKUP formula has the 4 parameters in the correct order. This was where I became stuck this afternoon. 

It should look similar to this: MODEL_LOOKUP(“AggregateTaskModelNameGoesHere”,“sumDuration”,“AggregateTaskModelGroupingAlias”,{{Id}})

The first parameter is the name of your aggregate model.

The second should be the name of the field that you are ultimately wanting to display, so, the sum of the Durations in your case.

The third parameter is the grouping’s Alias Name from your aggregate model.

The fourth parameter is referring to the field in your Cases model that contains the search term. It’s usually in double brackets / our merge syntax.

I would recommend experimenting with this on a very simple page, and making sure the last two parameters are grabbing the correct field names. For your use case, the last parameter should probably be the WhatId on your Case Model, and the third parameter would be the Alias Name you’ve chosen for the groupings in your Task aggregate model.