I have a custom console component visualforce page that is displayed in a sidebar of our console Case layout. This allows the user to make quick updates to the case and save them from the component. I want to show a confirm dialogue to the user if they have made changes in the sidebar component, not clicked save, and they close the primary tab that contains the Case detail view and the sidebar component.

I was hoping to use the following javascript on the console component visualforce page:

function myCallBack(result){
        console.log('set dirty');
        console.log('couldn't set tab dirty');


However, this doesn't work and I get the following message in the JS console:

setTabDirty: Cannot get view from frameId: ext-comp-1038

I've tried providing the enclosing primary tab Id to setTabUnsavedChanges as below but I get the same message.


Does anyone know a way to set the current primary tab as dirty from a component loaded in a sidebar?

Thanks a lot!

1 Answer 1


This code from documentation 'setTabUnsavedChanges()' worked from me:

Note: Using /support/console/40.0/integration.js because in my dev org 41.0 in URL doesn't work. Also you do not need to paas the tab id as a parameter.

<apex:page standardController="Case">
    <apex:includeScript value="/support/console/40.0/integration.js"/>

    <A HREF="#" onClick="testSetTabUnsavedChanges();return false">
           Click here to indicate this tab has unsaved changes</A> 

    <script type="text/javascript">
        function testSetTabUnsavedChanges() { 
            sforce.console.setTabUnsavedChanges(true, displayResult);
        function displayResult(result) {
             if (result.success) {
                 alert('Tab status has been successfully updated');
             } else {
                 alert('Tab status couldn’t be updated');



Screenshot below:

enter image description here

  • Thanks @rahul-sharma but that way only seems to work when you are calling setTabUnsavedChanges() from a visualforce page that is the main view of the tab. In my case the main view is a standard Case layout but my page is loaded as a sidebar component screenshot
    – jemble
    Oct 13, 2017 at 14:09
  • I have set the page as right side bar of case which is a subtab. Main tab is Account. Is my setting any different than yours?
    – Raul
    Oct 13, 2017 at 14:50
  • I don't know what I had done wrong but your code worked! Thanks a lot.
    – jemble
    Oct 16, 2017 at 9:27

You must log in to answer this question.

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