How to Display AccountContactRole Object details in Visualforce page

By | November 9, 2019

Hi, In this scenario we have shown how to display AccountContactRole object details using Visualforce….

Apex Controller

public  class AccountContactRoleDisplay {
    public List<AccountContactRole> records {get; set;} 
    public AccountContactRoleDisplay(){ 
        records = [Select accountId, ContactId, Role, IsPrimary FROM AccountContactRole];         
    } 
}

Vf Page

<apex:page Controller="AccountContactRoleDisplay" >
    <apex:form > 
        <apex:pageBlock >           
            <apex:pageBlockTable value="{!records}" var="a" >
                <apex:column value="{!a.ContactId}"/> 
                <apex:column value="{!a.accountId}"/>
                <apex:column value="{!a.Role}"/>
                <apex:column value="{!a.isPrimary}"/>
            </apex:pageBlockTable>           
        </apex:pageBlock>
    </apex:form>
</apex:page>

Output

Leave a Reply

Your email address will not be published. Required fields are marked *