Workflow - how to count related records


Is it possible to do with Workflow following scenario ?

I have custom module with field SumOf Semething. I need to update this field with sum (count) of related Accounts every time I add or revowe Account to record in my module.


You can probably achieve this by using an after_save and after_delete logic hook that runs after you save or delete the account. You can find more info here:


Adding or removing Account from/to Accounts is not my case.
I have relation MyModule -> Accounts one-to-many.

Let’s say MyModule is something like campaign and I can connect many Accounts to campaign. After each new connection (or disconnection) I want to be able automatically modyfi the number of Accounts connected to campaign (SumOf Semething field in MyModule).

Hope its clear :slight_smile: