Call us: 555-555-5555

How to count the number of child records under a parent using Apex

  • By Mike Arthur
  • 16 Aug, 2017

No need for any counter, use a Set and an Aggregate query

No content of my own here, just a pointer to someone who really knows what he's talking about, Peter_sfdc, the mighty Peter Chittum, check out his reply here:

(Of course, if you don't have a good reason to use Apex, you can always go with Flow, as explained by the equally mighty Mike Gill: )
Share by: