Templates / Marketing / Hubspot Form Submission to Anywhere / Salesforce

Hubspot Form Submission to Anywhere / Salesforce

Overview

This workflow allows you to use Hubspot Form Submission Data easily within your marketing and / or sales tools.

Which means you can use this template to quickly send form data into your stack.

Hubspot’s forms are often used to capture leads and their related information. This template takes advantage of the flexibility of Hubspot Forms in order to automate the addition of form fill information into any preferred service.

The key function of this template is to respond dynamically to whatever fields may be present in your Hubspot form.

All you need to do to get it working is:

  1. Set up your Hubspot form (in the Hubspot admin UI)
  2. Select the service you wish to send to (in your Tray workflow)
  3. Choose the form data to be included (in your Tray workflow)

End Result

The image below shows how this template converts any submitted Hubspot form from a complex nested structure into a simple 'flat' layer of data which can then be accessed and sent to any service of your choice:

Prerequisites

This workflow assumes the following:

  • You can Authenticate with Hubspot and have access to Hubspot Workflows.

Workflow logic

Getting Live

PLEASE NOTE: Both Hubspot and Tray.io have their own workflows in this setup. Please make sure to read the instructions carefully so you do not get confused about which service's workflow you should be referring to at each stage.

In order to configure this workflow for use, follow these steps:

For educational purposes, the rest of this page will take you through how the workflow template is built to achieve the desired results.

This will help deepen your understanding of Tray.io and will give you the power to maintain and edit your workflow as necessary.

Implementation notes

Data mapping

A key part of this workflow is that it can dynamically deal with any form data, whereby the fields present in one form will be different to another form.

The following screenshot shows the nested data received from a Hubspot form transformed into a simple 'flat' layer of json data that can easily be used in subsequent workflow steps:

When looping through data we need to have consistent field names to look for each time.

The issue with the form data is that each piece of response data has a different field name - i.e. "lastname", "phone", "hs_email_domain" etc.

So in order to make these consistent we convert them to key/value pairs:

So each piece of form data has the field name as the 'key' and all the rest of the metadata as the 'value'

Then, when we need to access each piece of data, we can use jsonpaths such as:

  • $.steps.data-mapper-1.output[0].key
  • $.steps.data-mapper-1.output[0].value

In this workflow the data is being looped through so the actual jsonpaths are slightly different.

First you can see that the Loop Connector is using $.steps.data-mapper-1.output to take the whole data mapper array as its input:

Then the connector snake is used to grab the relevant data from the output schema for a single result in the loop connector.

The screenshot below shows how the 'Value' is taking the value which appears in the third layer down, hence $.steps.loop-2.value.value.value:

Step-by-step explanation

Section 1 - Receive Form Data from Hubspot

Section 2 - Map properties

Section 3 - Create list (formData object)

Section 4 - Utilise Form Data