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

How can I update parent account with some field values from its child account ?

Hi ,


Is there any way ,so that I can update my parent account field (eg picklist field) from one of its child account ? I am unable to do so via trigger, at run time I am not able to find for selecting child account ID from where I need to pull records . 


Is this possible ? 


Till now i hve this trigger :


Trigger t on account (after insert) {


set<id> accids = new set<ID> ();

for(account a: { accids.add(AccountID); }


List<account> Acc = [Select ID from account where AccountID in :accids AND parentID =Null ] ;

// Above query gives me , Account ID that are actual parent account records but how can i find child account at this list .


Currently , I am considering for creating trigger on Parent accounts only .