Newer Version Available

This content describes an older version of this product. View Latest

Methods for Push Notifications

Push notifications are visual indicators on lists and detail pages in a Salesforce console that show when a record or field has changed during a user’s session. For example, if two support agents are working on the same case and one agent changes the Priority, a push notification displays to the other agent so he or she notices the change and doesn’t duplicate the effort.

When administrators set up a Salesforce console, they choose when push notifications display, and which objects and fields trigger push notifications. Developers can use push notification methods to customize push notifications beyond the default visual indicators supplied by Salesforce. For example, developers can use the methods below to create personalized notifications about objects accessible to specific console users, thereby eliminating the need for email notifications. For more information, see “Configure Push Notifications for a Salesforce Console” in the Salesforce Help.

Consider the following when using push notification methods:
  • Push notification listener response is only available for the objects and fields selected to trigger push notifications for a console.
  • When a Visualforce page includes a listener added by the addPushNotificationListener() method, the page receives notifications. The listener receives notifications when there is an update by any user to the objects selected for triggering console push notifications and the current user has access to the modified record. This functionality is slightly different from push notifications set up in the Salesforce user interface in that:
    • Listeners receive update notifications for changes made by all users.
    • Listeners receive notifications when an object’s fields are updated or created, even if those fields aren’t selected to trigger push notifications; and the notifications don’t include details about what changed. For example, if Status on the Case object is set to trigger a push notification, but Priority on the Case object changes, a listener receives a notification that the case changed without specifying details.
    • Listeners don’t obey the Choose How Lists Refresh and Choose How Detail Pages Refresh push notifications settings in a Salesforce console.
    • The only way to stop receiving notifications is to remove listeners using the removePushNotificationListener() method.
You can use the following methods for push notifications in a console:
Method Description
addPushNotificationListener() 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.
removePushNotificationListener() Removes a listener that gets added for a push notification. This method is only available in API version 26.0 or later. For more information on push notifications, see Methods for Push Notifications.