1

I am displaying a link on my VF page as follows:

  <apex:pageBlockTable value="{!rightObjectList}" var="rightObject">
       <apex:column headerValue="{!selectedObjectType}">
          <apex:outputLink value="{!URLFOR(rightObject['Id'])}">Link</apex:outputLink>
       </apex:column>
       ...
  </apex:pageBlockTable>

The link is displayed in the column of the table but when I click it, it opens a salesforce page and displays the error: Page [whatever the id is] does not exist. The url of the page is :

..visual.force.com/apex/ [the id seen in the error]

Now if I remove the 'apex/' from the URL and make the url :

..visual.force.com/[the id seen in the error]

it goes to the particulare page of the object.

My question is, how do I remove that apex/ in the VF page's outputLink, so when a user clicks it, he is redirect to the correct URL page.

Or is there any other way to display record page using the id?

3 Answers 3

3

Sounds like all you need is:

<apex:outputLink value="/{!rightObject['Id']}">Link</apex:outputLink>
1
  • Note that this solution fails on pages shown in Salesforce Communities. See this question for details.
    – tomlogic
    Commented Aug 31, 2013 at 1:16
1

Well have you tried using the below format ?

 <apex:outputLink value="/{!rightObject['Id']}">Link</apex:outputLink>

Probably this will lead you to the detail page

0
0

Since you are using pageblock table you already have every record of the object in the Var="rightObject" Instead of trying

  <apex:outputLink value="{!URLFOR(rightObject['Id'])}">Link</apex:outputLink>

try

  <apex:outputLink value="/{!rightObject.Id}">Link</apex:outputLink>

this will redirect you to the right link.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .