What is a PushTopic in Salesforce?

A PushTopic is record that

1. Defines a channel.

2. Determines what events will cause a notification. Event is a modification of a field while creating, updating, deleting or undeleting a record.

3. Describes the data the notification will contain.

Used in Streaming API.

NotifyForFields is used to determine when notification should be sent. NotifyForFields in PushTopic values.

1. All – considers changes in all fields.
2. Referenced – considers changes in fields in both SELECT and WHERE clauses.
3. SELECT – considers changes in fields in SELECT clause.
4. WHERE – considers changes in fields in WHERE clause.

Query limitation in PushTopic

1. Relationship reference is not supported. Example: SELECT Id, ABC__r.Name.

2. Sub Query is not supported. Example SELECT Id, (SELECT Name FROM ABC__r).

Supported CometD methods

1. handshake – for long polling connection

2. subscribe – subscribes to a channel

3. unsubscribe – un subscribes to a channel

4. disconnect – breaks connection

Leave a Reply