Skip to main content
Eveng All,

 

I have one scenario..

 

I have displayed the list of all accounts in VF page. 

 

Now I have redirected to the related account details page once i click on that account id or name. 

 

Please advise how to do in VF.

 

This is the code for displayed account details in VF page.

 

<apex:page Standardcontroller="Account" sidebar="false" recordSetVar="Account">

 

<apex:form >

 

<apex:pageblock title="Account Details">

 

<apex:pageBlockSection >

 

<apex:pageBlockTable value="{!Account}" var="a">

 

<apex:column value="{!a.Name }"/>

 

<apex:column value="{!a.Phone}"/>

 

<apex:column value="{!a.Id}"/>

 

</apex:pageBlockTable>

 

</apex:pageBlockSection>

 

<apex:pageBlockButtons >

 

<apex:commandButton value="Save" action="{!Save}"/>

 

</apex:pageBlockButtons>

 

</apex:pageblock>

 

</apex:form>

 

</apex:page>
4 respuestas
  1. 13 oct 2017, 11:14 a.m.

    try below code

    <apex:page Standardcontroller="Account" sidebar="false" recordSetVar="Account">

    <apex:form >

    <apex:pageblock title="Account Details">

    <apex:pageBlockSection >

    <apex:pageBlockTable value="{!Account}" var="a">

    <apex:column headerValue="Account Name" >

    <apex:outputLink value="/{!a.Id}" id="theLink" target="_blank" >

    {!a.Name}

    </apex:outputLink>

    </apex:column>

    <apex:column value="{!a.Phone}"/>

    <apex:column headerValue="Account Id" >

    <apex:outputLink value="/{!a.Id}" id="theLink1" target="_blank" >

    {!a.Id}

    </apex:outputLink>

    </apex:column>

    </apex:pageBlockTable>

    </apex:pageBlockSection>

    <apex:pageBlockButtons >

    <apex:commandButton value="Save" action="{!Save}"/>

    </apex:pageBlockButtons>

    </apex:pageblock>

    </apex:form>

    </apex:page>