One of the more powerful features of Formstack for Salesforce is the 'Upsert' feature. This allows you to define one or more fields in your form as 'Upsert' fields - that is, fields that decide whether we update an existing Salesforce record upon form submission or we create a new one. To mark a field as an Upsert field, simply check the box labeled 'Update existing Salesforce record matching this field value' in the field's settings area.
For fields that have this option enabled, Formstack will check your Salesforce instance upon form submission for existing records that match the value provided in all of those fields. If a match is found, Formstack will update the record with the information submitted in the form. Otherwise, Formstack will create a new record.
There are a number of important factors to consider when deciding to use Upsert functionality for your forms:
- Formstack will only update existing records if exactly one (1) match is found. If no matching records are found, Formstack will create a new record. However, if multiple matching records are found, the form submission will fail, and no records will be created or updated.
- In situations where you check 'Update existing Salesforce record matching this field value' for more than one field for an object, all of the fields will be considered when looking for an existing record. For example, if you check 'Update existing Salesforce record matching this field value' for First Name and Last Name, only records that match both the first name and last name of the form submission will be updated.
- Each of your form's primary and related objects have their own upsert fields. For each object, only the fields marked as upsert fields for that object will be considered when looking for a matching existing record.