i've a custom object Score has to be rollup to grand parent Account. Score-project-account is the lookup currently. How to get count of a field of score onto account?


You have 2 options,

1. Flow

  • Create a flow which runs when Score object Record Created
  • Get Parent Project Record Id - Store it in a variable
  • use get Records to get all child records (Score object) of Project
  • Loop through all Child records and use a variable in the Loop to keep track of Count of records
  • Update count on Parent Project record in a custom field (ex. Score Count)
  • Create a Roll up summary on Account which rolls up the New Score Count field.

2. Workflow/Process Builder

  • Every time Score record is Created or Project record is updated
  • Update Account field on SCORE object (a lookup field)
  • Add a roll up summary field on Account to roll up All Score object records.

If the relationships are all lookups which don't support rollup summaries you could use this package https://github.com/afawcett/declarative-lookup-rollup-summaries

Create a DLRS from the child to parent, and again from the parent to the grandparent.

Not the answer you're looking for? Browse other questions tagged or ask your own question.