function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
KimBaileyKimBailey 

How Do I Sum records from another custom object?

Hi.

I created a new custom object, called "referrals". 

Every record in this object has a couple of fields and also an "email" field.

In my accounts object, I created a new field - "number of referrals".

In this field, I want to get the total number of referrals that has the same email address as the account.

What's the best way to do that?

Thanks!
Deepak Kumar ShyoranDeepak Kumar Shyoran
Create a trigger which fire on insert, update delete and undelete event on "referrals" custom Object and will update the "number of referrals" field on Account with the help of email field.

Please mark it as best solution to your problem if it does solve your problem.
KimBaileyKimBailey
Is there a way to make this field "dynamic", which means everytime I view account details, the "number of referrals" field will calculate the number of referrals with the same email as the account?
Deepak Kumar ShyoranDeepak Kumar Shyoran
Yes, that trigger will fire dynamically and update "number of referrals" on Account according to Associated "Referrals" dynamically.