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.

Update

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.

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

Create

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:

  1. 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.
  2. It can be hard to tell if you a dealing with the right duplicate
  3. The information about one lead is stored in multiple places which is inefficient
  4. Duplicates are hard to remove if you want to change the model
  5. 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:

  1. Read the email address and first name, from the web form
  2. Use S4S to query Salesforce to see if a lead with this combination already exists, and if so, return all the matching records
  3. 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.