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
MikeyJamJamsMikeyJamJams 

This Has to be a Simple Solution - <apex:outputLink> is not opening link in parent window

Hello,

 

I have am embedded VisualForce page on one my custom objects. There is a lookup field, Attendee, and I cannot enable my page so that when a user clicks the Attendee, it opens the Attendee's detail page in the main window. Instead, it opens the Attendee's detail page within the embedded VisualForce page.

 

I have the following code for this field, and I can't figure out what to do. I've also tried using <apex:commandLink> instead, but I had no luck there, either.

 

            <apex:column headerValue="Attendee">
                <apex:outputLink value="/{!att.Attendee__c}" target="_parent">
                    <apex:outputField value="{!att.Attendee__c}" />
                </apex:outputLink>
            </apex:column>

 

If anyone could help that would be awesome. This is driving me crazy, and I can't imagine it's that hard of a fix. I've even tried target="_blank" but the the Attendee page still opens in the embedded VisualForce rather than a new window.

 

Also, I'm not sure if it's acting weird because of the <apex:outputField> tag because when I use the following code, it works, meaning the record page opens in the main window. However, instead of displaying the Attendee's Name, it displays their record ID, which I don't want, which is why I resorted to outputField.

 

            <apex:column headerValue="Attendee">
                <apex:outputLink value="/{!att.Attendee__c}" target="_parent">
                    {!att.Attendee__c}
                </apex:outputLink>
            </apex:column>

 

Best Answer chosen by Admin (Salesforce Developers) 
MikeyJamJamsMikeyJamJams

Hi Jeremy,

 

Thanks for the link. Unfortunately, I'm not very familiar with the page reference object, so I had to end up doing another work around.

 

I updated my Apex Class, so that instead of just pulling Attendee__c in my SOQL query, I also pulled Attendee__r.Name (Since Attendee is a lookup to Contact)

 

I was able to adjust my code to the following, and then it worked!

 

            <apex:column headerValue="Attendee">
                <apex:outputLink value="/{!att.Attendee__c}" target="_parent">
                    {!att.Attendee__r.Name}
                </apex:outputLink>
            </apex:column>

 Thanks,

Mike

All Answers

JHayes SDJHayes SD

Take a look at this post:  

 

http://boards.developerforce.com/t5/Visualforce-Development/Refresh-master-page-from-VF-page-in-new-section-area/m-p/495861#M55326

 

It's for refreshing the master page but you could simply construct a PageReference object that pointed to whichever record you wanted to navigate to.

 

Regards,

Jeremy

MikeyJamJamsMikeyJamJams

Hi Jeremy,

 

Thanks for the link. Unfortunately, I'm not very familiar with the page reference object, so I had to end up doing another work around.

 

I updated my Apex Class, so that instead of just pulling Attendee__c in my SOQL query, I also pulled Attendee__r.Name (Since Attendee is a lookup to Contact)

 

I was able to adjust my code to the following, and then it worked!

 

            <apex:column headerValue="Attendee">
                <apex:outputLink value="/{!att.Attendee__c}" target="_parent">
                    {!att.Attendee__r.Name}
                </apex:outputLink>
            </apex:column>

 Thanks,

Mike

This was selected as the best answer