Following is a list of example scenarios and the field values you need in a PushTopic record to generate notifications.
| Scenario | Configuration |
|---|---|
| You want to receive all notifications of all record updates. | <ul><li>MyPushTopic.Query = SELECT Id, Name, Description__c FROM Invoice_Statement__c</li><li>MyPushTopic.NotifyForFields = All</li></ul> |
| You want to receive notifications of all record changes only when the Name or Amount fields change. For example, if you’re maintaining a list view. | <ul><li>MyPushTopic.Query = SELECT Id, Name, Amount__c FROM Invoice_Statement__c</li><li>MyPushTopic.NotifyForFields = Referenced</li></ul> |
| You want to receive notification of all record changes made to a specific record. | <ul><li>MyPushTopic.Query = SELECT Id, Name, Amount__c FROM Invoice_Statement__c WHERE Id='a07B0000000KWZ7IAO'</li><li>MyPushTopic.NotifyForFields = All</li></ul> |
| You want to receive notification only when the Name or Amount field changes for a specific record. For example, if the user is on a detail page and only those two fields are displayed. | <ul><li>MyPushTopic.Query = SELECT Id, Name, Amount__c FROM Invoice_Statement__c WHERE Id='a07B0000000KWZ7IAO'</li><li>MyPushTopic.NotifyForFields = Referenced</li></ul> |
| You want to receive notification for all invoice statement record changes for vendors in a particular state. | <ul><li>MyPushTopic.Query = SELECT Id, Name, Amount__c FROM Invoice_Statement__c WHERE BillingState__c = 'NY'</li><li>MyPushTopic.NotifyForFields = All</li></ul> |
| You want to receive notification for all invoice statement record changes where the invoice amount is $1,000 or more. | <ul><li>MyPushTopic.Query = SELECT Id, Name FROM Invoice_Statement__c WHERE Amount__c > 999</li><li>MyPushTopic.NotifyForFields = All</li></ul> |