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
Sachin10Sachin10 

Getting ColumnNames correctly in Pageblock Table for person Accounts.

Hi Team,

I have a related list which displays the accounts on the Asset detail page.

The header columns appear as below: 

Person Account: Home Phone, Person Account: Email

 

But when I use a Inline VF Page and try to display them in Pageblock table

The header columns appear as:

Home Phone and Email.

 

I don't want to use Header Value as the first option as it will lead us into translations.

I was looking into some standard way of getting the correct column Names as in the Related List.

 

PsuedoCode:

 

ApexClass:

public class testAccount{
public List<Account> accntList{get;set;}

public testAccount(){
accntList = [select PersonHomePhone from Account limit 5];
}
}

 

Page:

<apex:page controller="testAccount">
<apex:pageBlock >
<apex:pageBlockTable value="{!accntList}" var="a">
<apex:column value="{!a.PersonHomePhone}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>

 

Any pointers or help is highly appreciated.

Many Thanks :)

 

 

 

nathaForcenathaForce

Hi Sachin10,

I think the below format would help:

 

<apex:column headerValue="Home Phone">
  <apex:outputField value="{!a.PersonHomePhone}"/>
</apex:column>

 

Let me know if this helps!

Nathalie

 

Sachin10Sachin10

@NathaForce,

Thanks for your reply.

I actually want the columns  to appear exactly how it appears in the Related list.

 

The header columns should appear as below: 

Person Account: Home Phone, Person Account: Email

 

And one more thing is I don't want to use headerValue as it would lead into translations.