Default UI page via URLFOR

I have some custom pages in which I want to include a link to the default UI page for the same object. My first go at this was to add another custom page that used the apex:detail component to replicate the default UI:

<apex:page standardController="Payment__c" >
    <apex:detail relatedList="true" relatedListHover="true"/>
</apex:page>

Then the link in my custom page was to this:

<apex:outputLink value="/apex/PaymentDefaultUI?id={!Payment__c.Id}">Payment</apex:outputLink>

But while trying to learn more about the sparsely documented URLFOR, I found a comment that a final boolean argument of true always opens the default UI page. So no additional custom page is needed after all and the link is fairly clean looking:

<apex:outputLink value="{!URLFOR($Action.Payment__c.View, Payment__c.Id, null, true)}">Payment</apex:outputLink>
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s