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
Praveen Venkata BPraveen Venkata B 

How to direct my page to standard Record details page from a VF added as a component on home page ??

I have added a VF page as a Component on Home page, now upon clicking on a record link, it need to direct the entire page to corresponding detail page. But this code displays the detail record on the component itself, not redirecting entire page to the record detail page. Below is my VF code:

Component on Home page:
Component on Home page
Detail view upon clicking recod link:

Detail page
But i need entire page need to be directed to record's detail page.

Below is my VF code:

<apex:page controller="RecAccConCtrl">
    <apex:pageBlock title="Recent Accounts & Contacts">
    
        <apex:pageBlockSection title="Accounts" columns="1" id="AccL">
            <apex:pageBlockTable value="{!Accounts}" var="Acc" >
                <apex:column headerValue="Account Name">
                    <apex:outputLink value="/{!Acc.id}" >{!Acc.name}</apex:outputLink>
                </apex:column>
                <apex:column value="{!Acc.Fax}"/>
                <apex:column value="{!Acc.Phone}"/>
                <apex:column value="{!Acc.Industry}"/>
            </apex:pageBlockTable>
        </apex:pageBlockSection>

    </apex:pageBlock>
</apex:page>


Below is my Controller:

public with sharing class RecAccConCtrl
{
    List<Account> myAcc;
    public List<Account> getAccounts() 
    {
        myAcc = [select Id, Name, Fax, Phone, Industry from Account order by CreatedDate DESC limit 5];
        return myAcc;
    }
}

Thanks,
Praveen venkata.
Best Answer chosen by Praveen Venkata B
Krishna SambarajuKrishna Sambaraju
Did you try adding a target attribute the outputLink.
<apex:page controller="RecAccConCtrl">
    <apex:pageBlock title="Recent Accounts & Contacts">
    
        <apex:pageBlockSection title="Accounts" columns="1" id="AccL">
            <apex:pageBlockTable value="{!Accounts}" var="Acc" >
                <apex:column headerValue="Account Name">
                    <apex:outputLink value="/{!Acc.id}" target="_top">{!Acc.name}</apex:outputLink>
                </apex:column>
                <apex:column value="{!Acc.Fax}"/>
                <apex:column value="{!Acc.Phone}"/>
                <apex:column value="{!Acc.Industry}"/>
            </apex:pageBlockTable>
        </apex:pageBlockSection>

    </apex:pageBlock>
</apex:page>
Hope this helps.
 

All Answers

Krishna SambarajuKrishna Sambaraju
Did you try adding a target attribute the outputLink.
<apex:page controller="RecAccConCtrl">
    <apex:pageBlock title="Recent Accounts & Contacts">
    
        <apex:pageBlockSection title="Accounts" columns="1" id="AccL">
            <apex:pageBlockTable value="{!Accounts}" var="Acc" >
                <apex:column headerValue="Account Name">
                    <apex:outputLink value="/{!Acc.id}" target="_top">{!Acc.name}</apex:outputLink>
                </apex:column>
                <apex:column value="{!Acc.Fax}"/>
                <apex:column value="{!Acc.Phone}"/>
                <apex:column value="{!Acc.Industry}"/>
            </apex:pageBlockTable>
        </apex:pageBlockSection>

    </apex:pageBlock>
</apex:page>
Hope this helps.
 
This was selected as the best answer
Praveen Venkata BPraveen Venkata B
Wow !!
thats a simple fix!!
thanks a lot Krishna.
it worked like magic :)