Newer Version Available
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
1swfobject.registerObject("clippy.codeblock-1", "9");
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17<apex:page standardController="Case">
18 <A HREF="#" onClick="testSetTabUnsavedChanges();return false">
19 Click here to indicate this tab has unsaved changes</A>
20
21 <apex:includeScript value="/support/console/23.0/integration.js"/>
22 <script type="text/javascript">
23 function testSetTabUnsavedChanges() {
24 sforce.console.setTabUnsavedChanges(true, displayResult);
25 };
26 function displayResult(result) {
27 if (result.success) {
28 alert('Tab status has been successfully updated');
29 } else {
30 alert('Tab status couldn’t be updated');
31 }
32 }
33
34 </script>
35</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
1swfobject.registerObject("clippy.codeblock-2", "9");
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17<apex:page standardController="Case">
18 <A HREF="#" onClick="testSetTabUnsavedChanges();return false">
19 Click here to indicate this tab has unsaved changes</A>
20
21 <apex:includeScript value="/support/console/25.0/integration.js"/>
22 <script type="text/javascript">
23 function testSetTabUnsavedChanges() {
24 sforce.console.getFocusedSubtabId(setTabDirty);
25 };
26 function setTabDirty(result) {
27 sforce.console.setTabUnsavedChanges(true, displayResult, result.id);
28 };
29 function displayResult(result) {
30 if (result.success) {
31 alert('Tab status has been successfully updated');
32 } else {
33 alert('Tab status couldn’t be updated');
34 }
35 };
36 </script>
37</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. |