There are 2 scenarios here -

  1. There is a custom lookup field on the case object, on click of the lookup - I need to open the record in the subtab. Is this possible?
  2. There are couple of output links (inline visualforce on the account detail page) - I need to open the record (output link is lookup to some other object record) in the subtab.

Is this possible?


For 1, in VisualForce see the same concept as 2 below, otherwise for standard layout you can set the way it opens under Setup->Create->App->your app->Edit->Choose How Records Display.

You can configure how each relationship opens up either as a separate primary tab or a subtab of a specific related object (or the current case itself).

enter image description here

Edit Per the comments you said it is in standard layout and actually a formula field. I don't know of any way of forcing a formula field to open in subtab, but you can do this with a detail custom link.

This will allow you to make a link on the standard layout that opens a subtab. To do so create a detail custom link with the behavior set to "Execute Javascript". Inside the javascript use the function srcUp like this (example opens Account in a sub tab):


You can learn more about the srcUp feature here in a blog post from one of the PMs of the Service Cloud, Gautam Vasudev:


For item 2 in VisualForce you can accomplish it with the console toolkit API.


Here is an example of opening a subtab from an outputLink (note: requires a remote access for google.com setup in your org. Change the url to something else for your own testing purposes).

<apex:includeScript value="/support/console/22.0/integration.js"/>
<script type="text/javascript">
function openSubTab(url,label,name,openimmediately) {
    sforce.console.openSubtab(primarytab.id , url, openimmediately, label, null, function(result){
      // do any processing here if passes or fails, use result.success (boolean)
    }, name);
<apex:outputLink value="#" onclick="openSubTab('http://www.google.com','google','googleSubTab',true);return false;">Open Google SubTab</apex:outputLink>
| improve this answer | |
  • for the first point, a bit of correction. It is actually not a lookup, but a formula field. – Roshan Sahatiya Feb 14 '14 at 9:21
  • Is it being displayed on a VisualForce page or standard layout page? – drakored Feb 14 '14 at 19:22
  • displayed as a standard page layout !! – Roshan Sahatiya Feb 17 '14 at 13:11
  • 1
    @RoshanSahatiya - added some info for you. I recommend a custom link if you can use that instead. I'm not aware of a way to get a formula field to function as you need. – drakored Feb 18 '14 at 4:43

This works for Salesforce Classic and Console in my org (Unlimited Edition).

Custom Field, Formula, takes a DATE/Time field and makes it a hyperlink.

HYPERLINK("javascript:if(typeof(srcUp)=='function') srcUp('/" & Id & "?isdtp=vw'); "+
"else {window.open('/" & Id & " ' )}",
TEXT( MONTH( DATEVALUE( Date_Time__c ) ) ) +
"/" +
TEXT( DAY( DATEVALUE( Date_Time__c ) ) ) +
"/" +
TEXT( YEAR( DATEVALUE( Date_Time__c ) ) ) +
" @ " +
TEXT ( VALUE( MID( TEXT( CreatedDate -5/24 ), 12, 2 ) ) ) +
":" +
TEXT ( VALUE( MID( TEXT( Date_Time__c -5/24 ), 15, 2 ) ) ), "_parent")
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.