The instructions below will show you how to set up the workflow to synchronize contact data between Emarsys and the Salesforce Commerce Cloud.
Once the cartridges are installed and the credentials have been configured in the Business Manager, a setup workflow needs to be run in order to fetch from Emarsys all the data that is necessary for the integration to work.
In the Business Manager, go to Administration > Operations > Workflow Schedules. Select the Emarsys-Setup workflow and click Run (queue and start).
This will fetch the following data from Emarsys:
- All the database fields in the Emarsys account (these are stored in a custom object in Salesforce: EmarsysProfileFields).
- All the external events in Emarsys (these are stored in a custom object in Salesforce: EmarsysExternalEvents).
- The Emarsys source ID (this will be saved in Salesforce in a custom preference attribute).
- All available values for the Emarsys single-choice fields (these are saved in Salesforce in a custom preference attribute in the Emarsys DB Init Configuration page: Emarsys Single Choice Value Mapping).
You can check that the setup workflow has completed successfully by going to Administration, Operations, Workflow Plan and checking that the status is OK.
To configure the newsletter subscription workflow, log in to the Business Manager and go to Merchant Tools > Emarsys Integration > Newsletter subscriptions. The settings for each of these can be accessed via their respective tabs.
You should configure the following settings on each tab for all three of the subscription methods.
Note: The parameters for all confirmation and unsubscribe links used in emails are provided here.
This defines the overall strategy for the method. The options are:
Single opt-in – This sets the subscribing contact’s opt-in field to
TRUEimmediately after submitting the subscription. No confirmation is required, although you can select an external event to trigger a follow-up action (such as a Welcome email) once this opt-in has reached the Emarsys database.
Double opt-in (highly recommended) – This triggers a confirmation email that the contact must respond to before their opt-in field is set to
TRUE. If you select this option, you must then define the Opt-in external event that triggers the confirmation email. Here you can also define a follow-up action (such as a Welcome email) once this opt-in has reached the Emarsys database.
Opt-in external event
Here you can select the external event which will trigger the follow-up email for the subscription. These external events are created in Emarsys and can be used to trigger Automation Center programs or API calls.
- If you have selected Single opt-in as your Opt-in strategy, you can trigger a welcome email, for example.
- If you have selected Double opt-in as your Opt-in strategy, this external event should trigger the confirmation email.
Double opt-in after confirmation external event
If you have selected Double opt-in as your Opt-in strategy, you can select another external event to follow up on the confirmation email, for example a welcome email (if you have Single opt-in as your Opt-in strategy, this should be set to No external event.
You will also need to map Emarsys fields with their respective Salesforce attributes before you can make your first upload of Salesforce customers to Emarsys. Proceed as follows:
In the Business Manager, go to Merchant Tools > Emarsys Integration > Database Load Configuration and click Add fields.
Select an Emarsys field from the drop-down on the left and map it to an attribute in the drop-down on the right.
Once you have mapped your fields, you will need to configure the Initialize Emarsys Database workflow schedule. This is done in the Business Manager > Merchant Tools > Site Preferences > Custom Site Preferences > EmarsysDBInitConfiguration.
On the Emarsys DB Init Configuration page you must configure the export settings (including opt-in) and the batch size for exports.
Configuring the export settings
Make the following settings:
- Export folder – This is the name of the folder on the Emarsys WebDAV where the .csv file will be uploaded.
- WebDAV URL, WebDAV Password, WebDAV Username – These are the credentials of the Emarsys WebDAV and will be provided to you by Emarsys Support.
Set Opt-in Status – This determines the opt-in status of the contacts imported from Emarsys using the initial database load feature. There are three options:
- 0 – The opt-in field is left empty for all users; this is the default setting.
1 – The opt-in field is set to
TRUEfor all users.
- 2 – The opt-in field value is set according to a custom attribute (this should be used when customers already have an attribute used to determine if they have subscribed for newsletter). When this option is selected, the merchant will have to add the ID of that custom attribute to the Opt-In Status custom attribute ID field.
You can also see the value mapping for the Emarsys single choice fields as provided by the Setup Workflow, and enter the email addresses which will receive the notification of the successful import.
Click Apply to save your changes.
Setting the batch size threshold
Your customers will be exported to Suite in batches of configurable size. The default size of a batch is set to 10,000 customers, but you can change this value in the Emarsys DB Init Configuration page in the Profiles export threshold field (see image above).
- Please keep in mind that setting a high value for the bulk size might affect the performance. Also, the bulk size should never be set to a value higher than 20,000 customers in order to avoid Salesforce quota violations.
- The recommendation is to schedule the workflow to run during low traffic periods.
- Set the recurrence according to the number of exported customers per iteration.
You can now return to the Workflow Schedules page and run the Initialize Emarsys Database schedule to generate the first export of contacts from Salesforce to Emarsys.
Your customers will be exported in batches and once all of them have been uploaded to Emarsys, a notification email will be sent to the list of addresses which you defined in the E-mail address for forwarding notifications field (see above). Email addresses should be separated by commas.
When the workflow schedule is finished, you must manually disable it. The Export Status field is used to prevent an export of customers after the Initialize Emarsys Database schedule was run, so that even if the workflow itself is not disabled, the export will be skipped. The Export Status checkbox is automatically activated once all the customers from Salesforce were loaded into Emarsys, so you should return to this page after you receive the notification email and deactivate it.