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.

Establish Connections

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.

without-components

To create a new automation, go to New>Automation.

Add Components

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.

with-components

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.

  1. Select trigger on the diagram.
  2. Set trigger type to Run on Schedule.
  3. Select the following settings: recurring, run every day, at 7-00, starting now and choose your time zone.

    schedule-settings

Select Actions

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:

  1. Click on your Action on the diagram.
  2. Select HubSpot from the available connections.
  3. Set Action to Execute Command.
  4. Enter the Select * from deals statement into the Command Text box.

    new-automation-action1

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.

new-automation-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:

  1. Select your Action.
  2. Select Salesforce from the available connections.
  3. Set Action to Upsert.
  4. Select Opportunity from the Table dropdown.
  5. Select the external ID that will be used for mapping. In our case it is import2_id__c.

    new-automation-action2

  6. Use Mapping Editor to map the required fields.

    new-automation-action2-mapping

Once it’s done, your first automation is ready. Don’t forget to give it a name at the top, and click Create.