Creating leads in Salesforce from Sitecore web forms sounds simple until you really start thinking about it! To save a lot of effort, you need clear business rules around lead creation before you start developing a solution.

So, you have a simple web form, maybe with the following fields:

  • First name text box
  • Last name text box
  • Email address text box
  • Area of interest dropdown list
  • Comments text box

The Submit button sends all this to Salesforce but wait! What will happen if a lead with the same email address already exists? Do we update it or insert a new record? Let’s look at the implications of both scenarios. Note that, in this context, a duplicate is a record with the same email address as another.


You would expect to query Salesforce for a matching email address and update the lead if it exists, otherwise create a new one. This is the out-of-the-box behavior of our S4S integration but there are some things to consider.

  • What if you need to capture every form submission independently? Either from the same form or other forms on the website.
  • What if the second web form submission creates a blank or overwrites lead data from the first submission?
  • What if you have dependant Salesforce objects that need to be updated at the same time?
  • What if you have Salesforce workflow or triggers that only fire on record CREATE?
  • What happens if you have groups, like families, that share a common email address?


Less common is the concept of creating duplicates on purpose. You might want to do this to mitigate the impact of the scenarios above but, this can create additional challenges:

  • It can be hard to confirm that similar leads are, in fact, the same person. This is particularly true if a person submitted the same form on different devices.
  • It can be hard to tell if you a dealing with the right duplicate
  • The information about one lead is stored in multiple places which is inefficient
  • Duplicates are hard to remove if you want to change the model
  • If you push Sitecore analytics to Salesforce leads using the S4S updater:
    • It will only update the first record if they were created from the same device
    • It will update all records if they were created from different devices and you are not using Sitecore Identify (on email address)
    • It will only update the first record if they were all created from different devices and you are using Sitecore Identify (on email address)

Evil duplicate

The Solution

You probably have complex rules around pushing data to Salesforce so S4S supports custom Save Actions. A developer can easily create a custom action that can be assigned to any web form. For example, your action may implement the following process when a Sitecore form is submitted:

  • Read the email address and first name, from the web form
  • Use S4S to query Salesforce to see if a lead with this combination already exists, and if so, return all the matching records
  • Execute any logic you need against the record data in Sitecore then, pending the result, do an update or insert into Salesforce. Instead of creating duplicates, you can append records in Salesforce to ensure any existing data is retained and not overwritten

S4S lets you do anything you like, you just need to determine what the anything is. Your only constraint is the number of API calls you make when querying Salesforce. To learn more about how S4S can add value to your business please contact us for more information.