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
Gaurav AgnihotriGaurav Agnihotri 

Visualforce Page on Account Page Layout.

I am successfully able to include visualforce page on Account layout. This page shows list of opportunities. Apex Code:
<apex:page standardController="Account" extensions="OpportunityController" sidebar="false" showheader="false">
<apex:pageBlock >
 <apex:pageBlockSection columns="1">
     <apex:pageBlockTable value="{!AccountOpportunity}" var="opty">
     <apex:column headerValue="Opportunity Name" > 
     <apex:outputlink title="Opportunity Name" value="/{!opty.id}">{!opty.Name}</apex:outputlink>
     </apex:column>
     <apex:column value="{!opty.Amount}"/>
     <apex:column value="{!opty.StageName}"/>
     <apex:column value="{!opty.CloseDate}"/>
     </apex:PageblockTable>
     </apex:pageBlockSection>
  </apex:pageBlock>
</apex:page>

Everything seems to work fine accept the output Link. 
<apex:outputlink title="Opportunity Name" value="/{!opty.id}">{!opty.Name}</apex:outputlink>

The link is opening a new SFDC session in section of the VFpage rather than navigating to Opportunity. Opening a new salesforce session in the visualforce page section
Any suggestions?

Regards, 
Gaurav
Best Answer chosen by Gaurav Agnihotri
Vivek DeshmaneVivek Deshmane
<apex:outputlink title="Opportunity Name" value="{!URLFOR($Action.Opportunity.View, opty.id)}" target="_top">{!opty.Name}</apex:outputlink>
If it not works then try replacing  target value as "_parent", "_self" or remove it  and let me know if it works

All Answers

Vivek DeshmaneVivek Deshmane
Hi,
Try below code and let me know if this works for you.
<apex:outputlink title="Opportunity Name" value="{!URLFOR($Action.Opportunity.View, opty.id)}" target="_blank">{!opty.Name}</apex:outputlink>

Best Regards,
-Vivek
Gaurav AgnihotriGaurav Agnihotri
Hi Vivek, 
Thanks for the prompt reply. After making the change, Opportunity opens in a new tab. This is definately a step in right direction. I was wondering if there could be a way to open/navigate to opportunity in the same tab.

Regards, 
Gaurav
Vivek DeshmaneVivek Deshmane
<apex:outputlink title="Opportunity Name" value="{!URLFOR($Action.Opportunity.View, opty.id)}" target="_top">{!opty.Name}</apex:outputlink>
If it not works then try replacing  target value as "_parent", "_self" or remove it  and let me know if it works
This was selected as the best answer
Gaurav AgnihotriGaurav Agnihotri
Thanks Vivek for your help. Your code seems to work.

Regards, 
Gaurav