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

Self relationship in an object and get the count of child records from related list

Hi Experts,

I have an object ( say Account) and defined a self relationship Account object which is 1 parent Account can have multiple child Accounts.

Now I have to get the count of child objects  from  the related list and update the count in parent... how to do achieve this?

Appreciate your inputs...

Arunkumar RArunkumar R

You definitely need to write a custom code using apex trigger.

Please refer the below blog it may help you.
Hi... I am how to query the relates list if  parent and child are of same object... 
eg : Account 1 is parent which is related with Account2,Account3,Account4 child object.....if any change in child object... the field should be updated in PARENT