How to refresh the parent tab from child tab in console app salesforce


Consider a scenario where we need to create a related object record of standard Case object, using the new button in the related list. For example, Case Asset is one of the related objects of the case object and its new button action is overridden with a custom page. The save action defined in the custom page routed us into the newly created case asset record page, after the successful record creation. But the parent Case tab will not automatically reflect this record creation and will require us going back to the Case tab and performing a manual refresh.Instead, can we refresh this from the child Case Asset tab itself?


Console App - Case to Case Asset record creation

The image shows the parent case tab and it’s child tabs. External Page is the custom page which was opened from the details page in a new tab.



Step 1

The oncomplete event of the record save button should call a js method like below.
<apex:commandbutton action="{!saveAsset}" oncomplete="doneComplete();"/>

Step 2

Define the javascript  function doneComplete.

[sourcecode language=”javascript”]
function doneComplete(){
//Check if the page opened in console application
function refreshSuccess(result) {

function showTabId(result) {
//Display the tab ID
sforce.console.refreshPrimaryTabById(, true, refreshSuccess);

sforce.console.isInConsole() – responds when its invocation happens in the console app.

sforce.console.getFocusedPrimaryTabId()  – console method provides the id of the primary tab which is currently active. showTabId is a callback which receives the parent tab id and calls the refresh console method.

sforce.console.refreshPrimaryTabById() – A console javascript function, to refresh the parent tab and the child components.

refreshSuccess – handler for a successful refresh.

Step 3 :

redirectToObjectDetail() – an action function which calls the server action and redirects to the object detail page.

<apex:actionFunction name=”redirectToObjectDetail” action=”{!backToObject}”/>

backToObject – action redirects to a page reference

[sourcecode language=”java”]
public PageReference backToObject(){
system.debug(‘caseassetId =’+caseassetId);
return new PageReference(‘/’+caseassetId);



The parent id fetched from the currently active primary tab is passed into the refresh console method provided by Salesforce. Then it refreshes the parent and child tabs. Please refer the below link to get the details of the console methods and leave a comment if you have any doubts.

Reference :


1 thought on “How to refresh the parent tab from child tab in console app salesforce”

  1. Pingback: How to refresh the parent tab from child tab in console app salesforce — Tech Evangel – SutoCom Solutions

Leave a Reply

%d bloggers like this: