Learn how to configure your App Connect flows to retrieve and process the right data at the right time.
When you add a “retrieve” action to one of your App Connect flows, you can configure your flow to make sure that you’re retrieving the right items:
- You can retrieve items that match certain criteria.
- You can retrieve a specified number of records (up to the maximum allowed).
- You can retrieve items only if a certain condition is met.
- You can define error handling for when something unexpected happens.
- You can define how you handle the items that are retrieved.
Here’s an example scenario where you might use a retrieve action in a flow to retrieve a single record. Say you’ve organized an event in Eventbrite. When one of your existing customers signs up for the event, you want your Sales department to contact them with some personalized offers. So you choose the “New attendee” event to begin your flow. You then add the Salesforce “Retrieve contacts” action, mapping the appropriate fields so that you retrieve the contact details and any other salient info from Salesforce for the customer that’s signed up to your Eventbrite event. You can then add the Gmail “Create message” action to the flow to e-mail this important data to your Sales team.
There might be times when you want to retrieve multiple records. Maybe you’re organizing a series of events in Evenbrite. This time, every time a new event is created, you want to retrieve data for all your customers who live in the vicinity so that you can target your marketing campaign at the right people. So you start your flow with the Eventbrite “New event” trigger. You then add the Salesforce “Retrieve leads” action, retrieving all your leads where the city of their address matches the city of the event. You can then add a “For each” node to process all the retrieved records, using the MailChimp “Add subscriber to a list” action to add each lead to the appropriate mailing list for your campaign.
This tutorial takes you through the process of creating a flow that retrieves items from your applications.
First, find or create everything you need:
- An App Connect subscription.
- The user names and passwords for the accounts that you want to access (if you haven’t already connected App Connect to your accounts).
- You can connect to your accounts now from the Applications tab on the Catalog page, or you can connect as you add each application to your flow.
- Some applications need some extra information to be able to connect to App Connect; if you need help finding this info, see “How to” guides for apps.
- An application that contains some data that you can retrieve.
To see which applications support retrieve actions in App Connect, go to the Applications tab on the Catalog page, and then type “retrieve” in the search field.
Next, create your flow:
(App Connect automatically saves your changes as you go. If you move away from the flow at any point, the flow is saved as a draft flow that you can come back to later.)
- Log in to App Connect.
- From the Dashboard, click New > Event-driven flow.
- Enter a name that identifies the purpose of your flow.
- Select your first application (source), then select the event that’ll trigger the actions in the rest of your flow.
For some trigger events, you might have to provide some info, like the name of an event or list that you’re expecting to be updated.
- Select a target application, then add a suitable retrieve action to your flow.
- Optional: If you want to retrieve records that meet certain criteria, define one or more filters.
- For example, if you want to retrieve a single item, set the filter to match fields that are likely to be unique, like an email address.
- To filter against more than one field, click Add condition, and define another filter. For example, if you want to retrieve employees for a particular branch of a company, you could add one condition that matches a company name, and a second condition that matches a particular city.
- Alternatively, if you want to retrieve all items of a particular type, delete the condition by clicking the X next to the field.
- Specify the maximum number of items that you want to retrieve, and what happens if the flow finds more than that number.
To set the limit to the maximum value allowed, you can click the icon .
If the flow finds more items than the maximum that you specify, you can choose to exit the flow at that point and issue an error. Or you can continue to process the maximum number of items that are found. The application that youâ€™re retrieving items from decides which items you retrieve.
- Define what happens if the flow finds no items that match your criteria.
You can choose to exit the flow at that point and issue an error, or you can continue through the flow, but issue a response code of â€ś204: No contentâ€ť. You can use that response code later in the flow. For example, you might add an If node to the flow that says if an action earlier in the flow has resulted in a â€ś204â€ť response code, take a particular action. You might want to send a message to someone to highlight the issue.
In the following example, we want to retrieve a lead from Insightly that has the same email address as a person whoâ€™s signed up for an event in Eventbrite. Email addresses are unique, so weâ€™re expecting to retrieve one lead. So weâ€™ve set the maximum number of items to retrieve to 1, and weâ€™ve said that if more than one lead is found with the same email address, we want to stop processing and issue an error. If no lead is found with the email address, we donâ€™t want to take any further action, so weâ€™ve chosen to exit the flow and issue an error.
Hereâ€™s a different example where weâ€™d expect to retrieve more than one item. This time, we want to retrieve all the Salesforce leads who work for a particular company in a particular city. Weâ€™ve set the maximum number of items to retrieve to 20. If more than 20 leads are found for this company and city, we just want to process the first 20 that we get back. And if we donâ€™t find any leads that match the criteria, we want to do something about that. So weâ€™ve chosen to continue the flow with an appropriate message. Weâ€™ll then add an If node later in the flow to take action for this response code.
Now, define how you’ll process your retrieved data:
- You can handle your retrieved items in two ways:
- Perform a single action for your list of retrieved items, such as emailing a list of leads to your Sales department
- Perform an action for each of the retrieved items, such as creating a row in a spreadsheet for details of each lead
To perform a single action for all the retrieved items, just add an action to your flow after the retrieve action. The following steps describe how to perform an action for each retrieved item.
- To process each retrieved item, click the plus (+) after the retrieve action, select the Toolbox tab, and add a For each node to the flow.
- In the “For each” dialog box, specify the items that you want to process by clicking in the field Select the collection of items to process, then clicking the Insert a reference icon . Select the appropriate object to process, such as leads or contacts.
- Optional: Edit the display name if you want to. This is the name that’s shown on the “For each” node in the flow.
- Define whether you want to process the retrieved records sequentially or in parallel.
If you process items sequentially, theyâ€™re processed in the order in which the application provides them. The flow waits until the first item is processed before it starts to process the next. If you process items in parallel, the flow starts to process them in the order that theyâ€™re received, but it doesnâ€™t wait until the first oneâ€™s finished before it starts to process the next one. So they could finish processing at different times. If you don’t care about the order in which records are processed, parallel processing is typically faster. But if you choose parallel processing, check that the applications that are used in the “For each” node can handle a large number of API calls in a short period.
- Specify what you want to do if an error occurs while processing one of the items.
If you don’t want one error to prevent the other records from being processed, select Process all other items and continue the flow.
If it’s important that all the records are processed, select Exit the flow with an error. Selecting this option means that the flow stops at that point, and no future actions in the flow are completed.
- In the “For each” node in the flow, click the plus (+) and select the action that you want to perform for each retrieved item.
- Configure the action in the usual way, mapping any relevant fields from the previous applications in the flow.
As well as mapping data fields from the previous applications in the flow, you can also map the status code from the retrieve action. For example, you could add a Slack “Create message” action to your “For each” node that posts the status codes for each of your retrieved items to Slack. Then your IT team can follow up any records that can’t be retrieved. You can add more actions to your “For each” node if you want to.
In the following example, weâ€™re processing some leads that weâ€™ve retrieved from Salesforce. We donâ€™t care about the order in which theyâ€™re processed, so weâ€™ve chosen to process them in parallel to optimize performance. Weâ€™ve added a Google Sheets â€śCreate rowâ€ť action to our “For each” node so that for each of the leads that we retrieve from Salesforce, a row will be created in a Google Sheets spreadsheet with the info that weâ€™ve mapped from the event and actions earlier in the flow. So if weâ€™ve retrieved 20 leads, weâ€™ll expect to see 20 rows in our spreadsheet when the flow has finished.
- Optional: You can add more actions to your flow after your “For each” node.
- When you’ve finished defining your flow, open the options menu [⋮] in the banner and click Start flow. Then click Dashboard to exit the flow. Your flow is now ready and waiting for the trigger event.
If you can’t find what you want, or have comments about this tutorial, please either add comments to the bottom of this page or send us your comments by email.