1. Help
  2. Salesforce
  3. Related records

Work With Related Records in Salesforce


In this tutorial, we will learn how to use the lookup workflow action to find a related record in Salesforce based on lookup conditions. Our form will:

  1. Lookup a contact based on the email address.

  2. Create a new case in Salesforce, associating it with the found contact.

Create a new form

On your Formcrafts dashboard click on Add Form → Start from scratch. Enter a Form name and hit enter. This will create a new form.

You can also create a new form by clicking on Add Form → Use a Template and selecting a template. This would allow you to skip this step.

Now add some basic fields to your form using the Add field button on the top-left corner of the form editor:

  1. Name (One line text)
  2. Email (Email)
  3. Comments (Comment)
Simple Salesforce new case form

Create a workflow

Click on the Workflows button on the top-left corner of the form editor, and then click on the Add workflow button.

Now edit the new workflow, and click on Add action. Under (select action) find Salesforce, and click on Connect to Salesforce.

Connect to Salesforce organization

This will open a popup window where you can connect to your Salesforce organization.

Configure the contact action

Our action should be Lookup a Lead.

Use the Lookup rules section to tell the workflow how to find the contact in Salesforce. We will use the email address to find the contact.

Salesforce lookup contact workflow action
Lookup contact workflow action

Lookup rules are powerful and flexible. You can use multiple rules, have and / or conditions, and even create groups.

Configure the contact action

In the same workflow, click on Add action again and select Salesforce.

The action now should be Create a Case.

Use the Field mapping section to map the form fields to Salesforce fields as follows:

Salesforce create new case workflow action
Create new case workflow action

We have mapped the result of the first workflow action (Salesforce Contact #1) to Contact ID. This will associate the new case with the found contact.

We have also mapped the form fields to the case fields.

Save and test

Click on the Preview button on the top-right corner of the form editor, and submit the form to test the workflow.

Formcrafts keeps a record of all successful and failed workflows which you can view using the Logs button on the top-left corner of the form editor.

Learn more about Workflow logs.

Workflow logs panel in Formcrafts


Conditional workflows

By default the Salesforce action(s) is triggered on each form submit. We can add conditions to our workflow to trigger the action(s) only when certain conditions are met. Edit your workflow and click on Add condition. Here you can add conditions, or even create condition groups.

Workflow with a condition
Making workflows conditional