Creating Your First Automation
In this chapter, we provide a step-by-step guide to a simple automation example that updates opportunities in Salesforce based on deals in HubSpot every morning.
To be able to work with Salesforce and HubSpot data, you need to create connections to both of them. To create a connection go to New>Connection, choose your app from the list of connectors, enter your credentials, and click Create Connection.
Create New Automation
Each automation consists of the automation flow that starts with Trigger and ends with Stop. Trigger and Stop appear on the diagram once you create a new automation.
To create a new automation, go to New>Automation.
An automation flow that consists of Trigger and Stop, doesn’t do much. Let’s extend it with some components. To add components to the automation flow, drag and drop them from the components pane on the left.
Set a Trigger
Now the automation flow includes Trigger, two Actions, Foreach, and Stop. Let’s configure the trigger to run the automation every morning at 7AM:
Connection and webhook triggers are not available in the early beta. You will be able to use event-based triggers in the upcoming releases.
- Select trigger on the diagram.
- Set trigger type to Run on Schedule.
Select the following settings: recurring, run every day, at 7-00, starting now and choose your time zone.
Get Deals From HubSpot
The automation flow will be executed every morning at 7-00 AM. There are two actions in our automation flow. The first one should get deals from from HubSpot.
To configure Action to get deals from HubSpot:
- Click on your Action on the diagram.
- Select HubSpot from the available connections.
- Set Action to Execute Command.
Enter the Select * from deals statement into the Command Text box.
Iterate Over the Array
Execute Command action always returns an array. In our case it is the array of deals. To iterate over the array use Foreach.
Choose the action that return data from the List dropdown. Use As to create alias for the array elements. We set it to Deal in this example.
Upsert Deals Into Salesforce Opportunities
To set Action to upsert deals from HubSpot to Salesforce:
- Select your Action.
- Select Salesforce from the available connections.
- Set Action to Upsert.
- Select Opportunity from the Table dropdown.
Select the external ID that will be used for mapping. In our case it is
Use Mapping Editor to map the required fields.
Once it’s done, your first automation is ready. Don’t forget to give it a name at the top, and click Create.