When to Use the Salesforce Console Integration Toolkit
Change a Visualforce Page by Using the Salesforce Console Integration Toolkit
addPushNotificationListener()
removePushNotificationListener()
Previous Versions
Adds a listener for a push notification. A user can only register a listener once until he or she removes the listener, or the listener is removed by another user. This method is only available in API version 26.0 or later.
For more information on push notifications, see Methods for Push Notifications.
1sforce.console.addPushNotificationListener( objects: array, eventHandler:Function )| Name | Type | Description |
|---|---|---|
objects | array | Objects set to receive notifications. |
eventHandler | function | JavaScript method called when there is a push notification. |
1<apex:page>
2 <apex:includeScript value="/support/console/68.0/integration.js"/>
3 <script type="text/javascript">
4
5 var eventHandler = function (result) {
6 alert('There is a push notification of object: ' + result.Id);
7 };
8 //Add a push notification listener for Case and Account
9 sforce.console.addPushNotificationListener(['Case', 'Account'], eventHandler);
10 </script>
11</apex:page>This method is asynchronous so it returns its response in an object in a callback method.
| Name | Type | Description |
|---|---|---|
id | string | The object ID of the push notification. |
entityType | string | The type of object included in the push notification. For example, Account or Contact. Objects available for push notifications are determined by the administrator who set up a Salesforce console. |
Type | string | The field of the object included in the push notification. For example, the Account Name field on Account. Notifications occur when the field is either updated or created. Fields on objects available for push notifications are determined by the administrator who set up a Salesforce console. |
LastModifiedById | string | The user ID of the user who last modified the object in the push notification. |