So here is what I need.I have to check for hierarchy for account, if there is parent account id , has to populate on ground level like Account A in the below example.
Then populate account name for account A for example and it will different for each account.
every time go to fetch xml for value of parent account id till parent id becomes null as its top level for whole chain then update that parent account id
Account Name: Account A
PAL: PAL A
ParentAccount Id= Account B
Account Name: Account B
PAL: PAL B
ParentAccount Id= PAL C
Account Name: Account C
PAL: PAL C
ParentAccount Id=
In this example, Account A's Parent account is "Account B" and "Account B's" parent is "Account C". Acccount C does not have a parentAccount Id so it is the top level Account for Account A and Account B.
So for Account A, aac_toplevepal= PAL C and aac_toplevelpalname=Account C
So for Account B, aac_toplevepal= PAL C and aac_toplevelpalname=Account C
So for Account C, aac_toplevepal= PAL C and aac_toplevelpalname=Account C
I have been breaking my head, could not find anything working. Can anyone be kind enough to help me please.