Display Parent Account if viewing Child account and Display all Children if viewing Parent

  • 1
  • Question
  • Updated 2 years ago
  • Answered
I'm creating a landing page for account managers and need to display the parent account if the record the user is viewing is a child but I want to also display the children if the record being viewed is the parent.  How would I go about accomplishing that in a table view so the user can easily see all accounts within the hierarchy when viewing the parent but easily get to the Parent account when needed.
Photo of Will Koscielny

Will Koscielny

  • 212 Points 100 badge 2x thumb

Posted 3 years ago

  • 1
Photo of Bill McCullough

Bill McCullough, Champion

  • 12,436 Points 10k badge 2x thumb
Will,

You can add the ParentId to your Account 'form' and then add a table that shows any Children accounts.  Here is what the Children model has as a condition.


Here is what you would see.

You could add a Drawer to show Children of Children.

If you really want to see the hierarchy, you can also use a Template component to display the Salesforce heirarchy page.  It's not a good looking as Skuid, but you would be able to see all parents and children.

Thanks,

Bill
Photo of Owen Smith

Owen Smith

  • 206 Points 100 badge 2x thumb
Bill, can you describe how to "use a Template component to display the Salesforce heirarchy page" as you mentioned in your post?


I see that salesforce uses this syntax to show the hierarchy:


...server.salesforce.com/acc/account_hierarchy.jsp?id=SFDCrecordid...



I put this in, but it just shows a URL. Do I need to use HTML to render the actual page, a Rich Text element or some combination thereof?


Thanks!
(Edited)
Photo of Bill McCullough

Bill McCullough, Champion

  • 12,436 Points 10k badge 2x thumb
Owen,

I think this will help you.  This is a sample of the HTML I added to a Template component to display a visualforce page that 'wrapped' the Salesforce Topic Widget.  The use case for me was to enable entry of Topics on a Task.
<iframe src="https://na16.salesforce.com/apex/TopicWidget?entityid={{$Param.id}}&isdtp=vw"; seamless="seamless" height="100" width="100%" frameborder="0"/>

Here is the visualforce page that I used to 'wrap' the topic widget.  I don't think you will need this.  I think you can add the URL to the accountheirarchy page directly to the 'iframe' above.  I am just adding it in case someone wants to repeat what I did.

<apex:page > <topics:widget entity="{!$CurrentPage.parameters.entityid}" renderStyle="enhanced"/> </apex:page>

Best regards,

Bill