Have a requirement related to Account hierarchy:
- Field on Account which should display the name of Ultimate parent at any child level.
- Certain fields would be such that if at any level, user changes the fields at parent, all the child records under it should be updated. The field values would be based on the latest updated parent/superparent not Ultimate parent.
Existing Solution- This was an existing design implemented using triggers, but was hardcoded upto 5 levels due to following limitation:
SOQL- "When dealing with Child to Parent, you can traverse up to 5 levels."
Option 1: As it is a trigger, I can't query all the records to get all Accounts under the hierarchy, due to 50k query limit.
Option 2: Using ultimate parent formula as suggested by Mr. Adrain. Hitting maximum number of 15 object references limit.
It would be great to know if anyone has an idea on how to implement the functionality with better design.