[SalesForce] Total number of child accounts on Parent record

I'm trying to create a rollup count of child offices related to a Parent on the Parent record. I've been beating my head against this for a few days. I've tried DLRS, and I've tried a combo of Flow and Process Builder but both approaches are failing. I think my issue with DLRS is the fields I'm trying to relate. I should note – I'm new to DLRS so these may be really stupid errors!

The Parent and Child Object are both Account. Not sure if that is a problem… I've tried referencing the Parent field using several syntax that I've found on line, but it really doesn't seem to like any of them. I've tried the Relationship Field as Account.Parent.Name (found this on one post), just Parent.Name, and just Parent. It doesn't like any of them.

The relationship criteria is Customer_Name__c=whatever the Parent syntax on the Relationship field is. The field to Aggregate is the same – whatever Parent syntax is in the other fields. Aggregate operation is count (haven't found documentation stating what the available operations are but Count is pretty standard…). Aggregate Result field is a custom field on the Parent called Total_Number_of_Offices__c. Calc Mode Realtime, Calc Sharing Mode System. One last thought – Customer_Name__c is a lookup field which is the other potential gotcha. I have a text field I can use if that helps.

The workflow/process builder keeps failing as well – I can provide particulars if that is a better route to take.

Best Answer

The field name is ParentId. That's your main hurdle so far.

The other problem you will encounter if I understand your requirements correctly is that you cannot compare a field to another field in SOQL. You'll need to create a checkbox formula that looks like:

Customer_Name__c = ParentId

Then filter on MyCheckbox__c = true instead of your current filter.

Related Topic