• mfriend
  • NEWBIE
  • 50 Points
  • Member since 2009

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies
I am diving into my first Apex trigger creation, and I'm hoping someone out there has some sample code that I can drop in.  We rely heavily on account hierarchies, and I'm writing some triggers to automatically update a few fields across the entire hierarchy when a user changes a value on one account in a family.  The starting point of this trigger is therefore being able to traverse the entire account family, and get a Set of IDs to update that represent all the accounts in that account family.  Our hierarchies can be fairly deep -- sometimes as many as 3 or 4 levels, and I'd like the code to be able to work from anywhere in the hierarchy and update ALL related accounts.

Does anyone have a sample that would take a single account ID as its input and return a set of IDs for all accounts in the family?  It would be a huge time saver.

I'll be sure to post my finished trigger for all to use when it's done!

Thanks in advance.
We need to add some fields to the "Account Hierarchy" screen that lists the parent-relationships for accounts. I can't locate where to do this. Any ideas?
 
Chris
 
 
  • August 22, 2008
  • Like
  • 0
I am diving into my first Apex trigger creation, and I'm hoping someone out there has some sample code that I can drop in.  We rely heavily on account hierarchies, and I'm writing some triggers to automatically update a few fields across the entire hierarchy when a user changes a value on one account in a family.  The starting point of this trigger is therefore being able to traverse the entire account family, and get a Set of IDs to update that represent all the accounts in that account family.  Our hierarchies can be fairly deep -- sometimes as many as 3 or 4 levels, and I'd like the code to be able to work from anywhere in the hierarchy and update ALL related accounts.

Does anyone have a sample that would take a single account ID as its input and return a set of IDs for all accounts in the family?  It would be a huge time saver.

I'll be sure to post my finished trigger for all to use when it's done!

Thanks in advance.
We need to add some fields to the "Account Hierarchy" screen that lists the parent-relationships for accounts. I can't locate where to do this. Any ideas?
 
Chris
 
 
  • August 22, 2008
  • Like
  • 0