Suivez votre progression
Accueil Trailhead
Accueil Trailhead
Durée estimée

Set up PushTopics for Real-Time Updates

So far, you’ve learned about the different systems within NTO’s infrastructure and the business challenges they present. You also crafted a plan to implement your integration that automates and simplifies these challenges. Let’s get started building our flow. First, you need to trigger your integration as soon as an Opportunity is marked as Closed Won in Salesforce. To do this, use the Salesforce Streaming API that can trigger events to invoke your integration in near real time. 

First, tell Salesforce what fields to send and your criteria for the trigger using an SOQL query. Once the query is built, you can set up a PushTopic that your integration can subscribe to. Here’s how to set it up.

  1. Navigate to workbench SOQL query builder. You can log in with your Salesforce credentials.
  2. For Object, select Opportunity.
  3. Under Fields, select Amount, CloseDate, Id, and Name.
  4. In the Filter results by dropdown, select StageName = then enter Closed Won as your criteria.
  5. Your query should look like this: SELECT Amount,CloseDate,Id,Name FROM Opportunity WHERE StageName = 'Closed Won'. Click the Query button to test it. You should get a list of all closed opportunities.
    Screenshot of Workbench building an SOQL query.
  6. Copy the query to your clipboard.
  7. From the top menu bar, click the queries dropdown and select Streaming PushTopics.
  8. For Push Topic, select Create New.
  9. For Name, enter ClosedOpps.
  10. Paste the SOQL query you built in the Query section.
  11. Click Save.

Screenshot of Workbench showing the Streaming PushTopics page.

Now, every time the query criteria is met, Salesforce pushes an event into the ClosedOpps PushTopic. 

This means everytime NTO wins new business, an event will be pushed onto our topic. Now you need to use this event to trigger your integration. NTO uses Anypoint Platform for their integration needs. In the next section, you create your first integration application within Anypoint Design Center. 

We won’t check any of your setup. Click Verify Step to go to the next step in the project.

Resources