How to Update an Existing Record Using Salesforce Forms
In this tutorial we will create a contact us form that creates a new record in Salesforce, or updates an existing record if it already exists.
Create a new form
On your FormCrafts dashboard click on New Form. This will open a popup dialog where you can choose to start from a scratch, select a template, or duplicate an existing form. For this tutorial we would select Blank Form. On the next screen enter the form name and press Enter.
We now have to add fields to our form. Using the Add Field button on the top-right corner of the screen add the following fields to your form:
- A one line input field. Label this one What is your first name?
- Another one line input field. Label this one What is your last name?
- An email field. Label this one What is your email?
- A commend field. Label this one Any comments?
At this point our form would look like this:
Connect to Salesforce
Next click on the Salesforce icon on the top-left corner of the screen, and click on Connect an organization. This will open a popup where you can authorize your Salesforce account.
Now click on the Records tab. Here click on Add Action. There are 4 different ways to configure record manipulation:
This always creates a new record
- Create if
This creates a new record if the lookup succeeds
- Create or Update
This updates the record if lookup succeeds, or creates a new one if lookup fails
- Update if
This updates the record if lookup succeeds
This simply tries to find a record. This method does not manipulate the record, but we can use the lookup reference when working with other actions.
Now, click on Create and select Create or Update instead. Where it says (select object) pick Contact. Effective our action is: Create or update a Contact in Salesforce when someone submits the form.
For update to work we need to first have a set of lookup conditions. For this form we can have one simple lookup condition: the email needs to match. Create a lookup condition: Email is What is your email?
Next we have to map our form fields to their respective Salesforce counterpart.
Click on (select) and select the What is your first name? field. Next click on (Salesforce field) and select First Name. Now click on Add. We will map the other form fields in this manner. Our field mapping should then look like this:
That was the last step. You can now click on Preview (top-right corner) and fill out the form and hit submit. This will create a new contact or update an existing one in your Salesforce account in real-time.