Declarative lookup Rollup Summaries (DLRS) with lookup field
Updated: Dec 4, 2021
Salesforce is great for making object creation, but one thing it doesn't make so easy is jumping tables as you MUST use a Master lookup to create a Rollup Summary field. To facilitate this Andrew Fawcett created DLRS an amazing tool.
Recently while trying to implement a use case we found that when using a lookup field to execute this calculation it doesn't execute in real time.
If we set it to execute on schedule the calculation does execute.
To fix this issue we created a second field and an update process on the child record that has the same value as the lookup field.
But it wasn't until we filled the "Relationship Criteria Fields" that it really started working.
According to the documentation:
Relationship Criteria Fields – This is where we will want to list each field that we used in the above Relationship Criteria on a separate line. We don’t need to copy the logic just need to copy the API Field Names.
To us this translates as if we were coding using a SOQL query where the "Relationship Criteria" is the Where clause and "Relationship Criteria fields" is the selected fields.
Select id, MyMilliq_status__c //Relationship Criteria fields
WHERE MyMilliq_Status__c //Relationship Criteria
Hopefully this helps you reduce the debugging time as we couldn't understand initially why the calculation executed correctly but it wasn't happening in real time.