Why combining sitecore and salesforce marketing cloud (SFMC) is a great idea
Tags: sitecore, salesforce
Published: 2020-01-30 10:48:41

Besides a Sitecore web application, we also improve customer relations and increase sales by integrating Salesforce Marketing Cloud, which is a platform for delivering relevant, personalized journeys across channels and devices — enabling marketers to deliver the right message at the right time throughout all phases of the customer relationship. By combining both Sitecore and Salesforce we can further boost the results.


Sitecore offers out-of-the-box connectors with Salesforce Sales Cloud and Salesforce Marketing Cloud (SFMC).

We had already several versions of the SFMC connector with a focus on seamless integrations:

1. between the Sitecore Media Library or the Digital Asset Management of Sitecore Content Hub with the SFMC Content Builder
2. between dynamic lists in Sitecore and Data extensions in SFMC

But what about integrating Sitecore Forms with SFMC? For example, when we create an event (such as our Digital Resilience event) a page with a form is created on our website (via the Sitecore CMS, see figure 1). When a user submits the form, the data could be inserted into Salesforce’s data extensions and the subscriber information is updated or created.

Here you can find an example of how the form can look like:

![Form](https://thepracticaldev.s3.amazonaws.com/i/wh1u7vk3x1flhj9tx6wz.png)

Although Salesforce offers an extensive API to do this, custom code is required to make it work with Sitecore Forms. That is because form specific fields must be mapped to specific columns in Salesforce which means the code is not reusable. Whenever we organize a new event or create a new form, new custom code must be created. This is also the case when a form is changed (for instance a field is added): the existing code must be adapted in order to map that new field to a Salesforce data extension column. Since coding has changed, new deploys are necessary.

In order to address this issue, we did an experiment by creating a generic Salesforce Marketing Cloud Save Actions module (SFMC Save Actions) that we can re-use in our projects.

# What has the module to offer? 
The module automates the process of adding form data from Sitecore Forms to a Salesforce data extension, creating (or updating) a subscriber and adding him or her to a subscriber list. But how does this work? 

First, we created a save action, this is the code that is executed when submitting a form, which you can add to a form. Then, in a dashboard app, you can create bindings between forms and data extensions. In those bindings, mappings between the form fields and the data extensions must be configured. You can also configure to create or update a subscriber when the form is submitted. The mapping between the form fields and the subscriber fields can thus also be set! And lastly, you can select to which list that user must be added.

# Simplicity and user friendliness
One of the benefits of this module is that it is easy to set-up and use, for both the development team and the content editor. The development team does not have to do anything besides installing the Sitecore package and adding the authentication details of the Salesforce account to the website configuration. Once the set-up is complete, the development team is not needed anymore and can have a nice cup of tea before continuing working on other cool stuff!

Not only the development team but also the content editor can enjoy the module’s simplicity and user-friendliness. The editor only needs to add the save action to the submit button of a form and, by using the dashboard app, create a binding between the form and a data extension in Salesforce. 

To make things even easier, all the data is obtained from Salesforce and Sitecore so that the content editor doesn’t have to remember any form field, data extension or data extension column when mapping form fields to data extension columns. And the dashboard application has an all Sitecore look and feel, which makes the life of the content editor much easier.

# It's an all sitecore solution
The package itself is an all Sitecore solution, meaning all data is stored in Sitecore items. This means that no additional custom database must be installed and additionally, which means it is possible to move the data between environments by just creating a Sitecore package. 

# Conclusion
In short, with the extensive API of SFMC and the flexibility of the Sitecore platform, it is easy to build a generic and re-usable integration. Once done, it is easy to set-up and use, while offering a Sitecore look and feel so that content editors can map form fields to Salesforce Marketing Cloud fields with ease. It offers such a flexibility that after the set-up no development work is needed. It’s just everything you need!