Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
setTabUnsavedChanges()
Sets the unsaved changes icon (
)
on subtabs to indicate unsaved data. This method is only available in API version 23.0
or later.
)
on subtabs to indicate unsaved data. This method is only available in API version 23.0
or later.Syntax
1sforce.console.setTabUnsavedChanges(unsaved:Boolean, callback:Function, (optional)subtabId:String)Arguments
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>
4
5<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 }
17
18 </script>
19</apex:page>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>
4
5 <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>Response
This method is asynchronous, so it returns its response in an object in a callback method. The response object contains the following field:
| Name | Type | Description |
|---|---|---|
| success | boolean | true if returning the focused subtab ID was successful; false if if returning the focused subtab ID wasn't successful. |