I have created a custom Visualforce page for a New Case creation. If I don't set the SubTab Label it displays 'External Page' and when I save my Case the standard Case page shows the Case icon and Case number correctly on the tab.

If I set the SubTab label to be something like 'New Case' the label will persist on the standard Case page for the saved Case.

// Set the Tab Label
var tabLabel = "New Case"; 
    sforce.console.setTabTitle(tabLabel, result.id);

How can I reset the label after saving the Case so the Standard Case display page will show the Case icon and Case number?

1 Answer 1


I have a similar circumstance.

A little background: I have a Visualforce Page in the Case layout that looks like a linked field. When the link is clicked, I change the primary tab content and title through the Salesforce Console Integration Toolkit.

Anyway, though it is more convenient for me because I already have this functionality in my layout, you can merge a Visualforce Page into the Page Layout and use the toolkit from there. If you set its height to 18px it looks just like a blank space or field as you desire.

<apex:page standardController="{!Case}" showHeader="false" standardStylesheets="false">
    (function (c) {
        c.getFocusedPrimaryTabId(function (result) {
            c.setTabTitle("{!Case.CaseNumber}", result.id);

Fun gotcha, the getFocusedPrimaryTabId doesn't return anything. You can only access the primaryTabId from its callback. Also remember id is case sensitive, unlike in Apex.

  • 1
    I had hoped in my life never to have to learn the SF Console Toolkit but recently was faced with an issue related to OP and this code snippet was exactly what I needed.
    – cropredy
    Jun 10, 2020 at 16:09

You must log in to answer this question.

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