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

Keeping the count of records in the related list.

I am quite new to apex and triggers and stuck at a point.

I have 2 objects Account(Standard) and DummyObject(Custom) and a junction object AccountDummy joining these 2. The junction object has a look-up on both Account and the DummyObject. There is a related list of Accounts on DummyObject and I want to have the count of these Accounts which I will store in a custom number field on my DUmmy Object.

I searched for various solutions online but nothing seems to be working as I want.  Ane help is greatly appreciated :)


Make use of Roll Up Summary Fields 


Roll-up summaries work in master-detail only. As I mentioned, I had look-up relationship. I got it figured out. 

Thanks anyway :)