Newer Version Available
Step 5: Test the PushTopic Channel
-
Load the Visualforce page that you created in a Web browser by using the following URL:
https://myinstance.salesforce.com/apex/StreamingAPIDemo where myinstance is the name of your Salesforce instance, such as na1.
- In the text box, enter the channel name: /topic/InvoiceStatementUpdates.
- Click Subscribe to subscribe to the channel.
-
Create or modify an InvoiceStatement in a different browser.
You should see the event notification appear on the Visualforce page. The output should resemble the following:
1{ "event": 2 { "type": "updated", 3 "createdDate": "2012-01-27T20:22:28.000+0000" 4 }, 5 "sobject": { 6 "Name": "INV-0005", 7 "Id": "a00D0000008oLiSIAU", 8 "Description__c": "Waiting for vendor materials report.", 9 "Status__c": "Pending" 10 } 11} 12_____________ 13{ "event": 14 { "type": "created", 15 "createdDate": "2012-01-27T20:24:47.000+0000" 16 }, 17 "sobject": 18 { "Name": "INV-0012", 19 "Id": "a00D0000008oMt8IAE", 20 "Description__c": "New invoice for Pyramid Construction, Inc.", 21 "Status__c": "Open" 22 } 23} 24_____________The first event notification shows the notification data when an invoice statement is created. The second notification shows the notification data when an invoice statement is updated.
Click Unsubscribe to unsubscribe from the channel and stop receiving notifications.