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){
if(result.success){
console.log('set dirty');
}
else{
console.log('couldn't set tab dirty');
}
}
$('#myInput').on('change',function(){
sforce.console.setTabUnsavedChanges(true,myCallBack)
});
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.
sforce.console.setTabUnsavedChanges(true,myCallBack,'scc-pt-3');
Does anyone know a way to set the current primary tab as dirty from a component loaded in a sidebar?
Thanks a lot!