If true, the tab is marked as having unsaved changes.
callback
function
JavaScript method that’s called upon completion of the method.
subtabId
string
The ID of the subtab that is marked as having unsaved changes. This argument is only available in API version 25.0 or later.
Sample Code API Version 23.0 or Later–Visualforce
1<apex:page standardController="Case">2 <A HREF="#" onClick="testSetTabUnsavedChanges();return false">3 Click here to indicate this tab has unsaved changes</A> 45<apex:includeScript value="/support/console/68.0/integration.js"/>6 <script type="text/javascript">7 function testSetTabUnsavedChanges() { 8 sforce.console.setTabUnsavedChanges(true, displayResult);9 };10 function displayResult(result) {11 if (result.success) {12 alert('Tab status has been successfully updated');13 } else {14 alert('Tab status couldn’t be updated');15 }16 }1718 </script>19</apex:page>
To see this example in action, click the custom link on a case. For more information, see Define Custom Buttons and Links in the Salesforce help.
Note
Response
This method returns its response in an object in a callback method. The response object contains the following field:
Name
Type
Description
success
boolean
true if update was successful; false if update wasn’t successful.
Sample Code API Version 25.0 or Later–Visualforce
1<apex:page standardController="Case">2 <A HREF="#" onClick="testSetTabUnsavedChanges();return false">3 Click here to indicate this tab has unsaved changes</A> 45 <apex:includeScript value="/support/console/25.0/integration.js"/>6 <script type="text/javascript">7 function testSetTabUnsavedChanges() {8 sforce.console.getFocusedSubtabId(setTabDirty);9 };10 function setTabDirty(result) {11 sforce.console.setTabUnsavedChanges(true, displayResult, result.id);12 };13 function displayResult(result) {14 if (result.success) {15 alert('Tab status has been successfully updated');16 } else {17 alert('Tab status couldn’t be updated');18 }19 };20 </script>21</apex:page>