Update Existing Salesforce Records (Update Query)

About

Salesforce data destinations can be set up to update existing records in Salesforce.  

When a form is submitted, ProntoForms can run a search for matching records that already exist in Salesforce.  Control what happens when a match (or more than one match) is found - whether the record is updated or a new record is created. 

For example, a form can be used to create accounts in Salesforce.  However, if the account already exists, a duplicate account entry may not be desirable.  Instead, the existing account can be updated to match the newly-collected information. 

Find the options below in the "Salesforce Update Query" tab in any Salesforce data destination.

 

Match Handling

Update Handling

This controls whether new records are created or existing records are updated when the data destination executes.

updatehandling.png

Never update, always create new

    • A new record will always be created.
    • There will be no search of existing records.
    • This option will use fewer SalesForce API calls.

Update if exists, otherwise create new

    • The query will run and search for matches.
    • If no matches are found, a new entry will be created.
    • If a match is found, the Salesforce entry will be updated with the new information.

Update if exists, do not create new

    • The query will run and search for matches.
    • If a match is found, that entry will be updated.
    • If there is no match found, no new entry will be made.
    • Note: If "Create a new record" is chosen for handling of "multiple matches", a new record will still be created when this option is selected.

[ top ]  

 

If multiple matches are found...

This option controls what happens when multiple matches are found. By default the query will return results by creation date, with newest records first. To change this, add an "order by" statement in your custom query.

multiplematches.png

  • Update the first record found: The first entry will be updated.
  • Update the last record found:  The last entry will be updated.
  • Create a new record:  If multiple matches are found, a new entry will be created, rather than updating an existing entry.

[ top ]  

 

Query Options

 query.png

Two options are available for building the query to search for matches.

  • Query builder (default): Simply list fields to check for a match in.
  • Custom SOQL query: Build a query from scratch using DREL and SOQL (Salesforce Object Query Language).

 

Query Builder

builder.png

Query Operator

  • And: ALL the following fields must match in order to consider the record a match.
  • Or: ANY of the following fields must match in order to consider the record a match.

Fields to Match

Press "describe object" to retrieve a list of available fields and their API names.

  • Salesforce API Name: enter the API name of the field to match
  • Value Expression: enter a value to match using Data Record Expression Language
    • To check if the field matches the answer to a form question, type %a[Question Label].  
    • Date/Time values must match the expected Saleforce format
      • Date only: YYYY-MM-DD
      • Date and Time: YYYY-MM-DD:mm:ss+hh:mm

[ top ]  

 

Custom SOQL Query

Custom Salesforce SOQL Query

Optionally write your own query using the Salesforce SOQL (Salesforce Object Query Language), combined with the ProntoForms Data Record Expression Language (DREL).  Read more about the SOQL language here: http://www.salesforce.com/us/developer/docs/soql_sosl/

 custom.png

Sample query:

Select FirstName, LastName, CompanyName from Contact where FirstName= '%a[FormFieldFirstName]' and CompanyName = '%a[FormFieldCompanyName]' and LastName = '%a[FormFieldLastName]' order by CreatedDate DESC
  • When creating your custom query the DREL expression must be surrounded by single quotes.
  • Date/Time Fields in the form must match the only acceptable format by Salesforce:
    • Date only: YYYY-MM-DD
    • Date and Time: YYYY-MM-DD:mm:ss+hh:mm

[ top ]  

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments