This topic is for administrators and developers with administration access rights in Salesforce.
This topic describes how to copy and synchronize Salesforce data sets of contacts, leads, and personal accounts with your Optimizely Campaign recipient lists. For this purpose, the Salesforce add-on adds two Apex classes to the Salesforce Process Builder:
- Upsert Recipient. Updating recipients or adding new recipients.
- Delete Recipient. Deleting leads, contacts, and personal accounts from an Optimizely Campaign recipient list.
Optimizely customer support must prepare your Optimizely Campaign recipient lists for the Salesforce synchronization. Provide information about the client in which you want to use recipient lists for the Salesforce synchronization.
Generating processes and using Apex classes
Once customer support has prepared the desired recipient lists, set up processes in Salesforce to automatically copy contacts, leads, and personal accounts in Optimizely Campaign recipient lists. For example, you can set up processes that filter customers according to a certain status and transfer them to a corresponding recipient list, such as new customers in a recipient list that only contains new customers.
For contacts, leads, and personal accounts in this example, a Boolean reference field (true/false) called Premium Customer was created first that you will need for configuring the process. See Creating reference fields.
Setting up processes
- Go to the Setup area in Salesforce.
- In the left menu bar, click Process Automation > Process Builder.
- In the My Processes window, click New.
- In the Process Name field, enter a name for the process, such as Premium Customers.
- Enter a name under API Name, such as Premium_Customers.
- Optional: Enter a description in the Description field.
- Select A record changes in the The process starts when drop-down list.
- Click Save.
Adding criteria and defining Apex classes
- Click Add object in the flowchart.
- In the Choose Object and Specify When to Start the Process window, select the entity in the Object drop-down list that you want to set up the process for: Lead, Contact, or Person Account.
- Under Start the process, enable when a record is created or edited.
- Click Save.
- Click + Add criteria.
- In the right window, enter a name for the criterion in the Criteria Name field, such as Is Premium Customer.
- Under Criteria for Executing Actions, select Conditions are met.
- Under Set conditions, select the Premium Customer reference field from the drop-down list under Field and confirm your selection.
- Set the Operator to Equals, the Type to Picklist, and the Value to Primary.
- Under Conditions, select the All of the conditions are met (AND) option.
- Click Save.
- Click Add action under Immediate actions in the flowchart.
- In the Select and Define Action window, select the Apex entry from the Action Type drop-down list.
- Enter a name under Action Name, such as Add Premium Customer.
- Select the Upsert Recipient entry from the Apex Class drop-down list.
You need to configure three variables for the Upsert Recipient Apex class: recipientId, recipientListId, and sfOptInId.
- Under Set Apex Variables, click Add Row three times.
- In the first drop-down list under Field, select the recipientId variable and set the type to Field Reference. Depending on the desired entity type, select the Lead Id, the Contact Id, or the Personal Account Id in the Value field.
- In the second drop-down list under Field, select the RecipientListId variable and set the value to the ID of the Optimizely Campaign recipient list to which the Premium Customers are to be copied. To see the recipient list ID, open the Optimizely Campaign menu and select Administration > API overview > Recipient lists.
- In the third drop-down list under Field, select the sfOptInId variable and set the value to the Salesforce ID of the created advertising permission. The type will automatically be set to String; do not make any changes here.
- Click Save.
Deleting recipients from one recipient list and adding them to another recipient List
For example, a Premium Customer has achieved high revenues and qualified as a Platinum Customer. You want to delete this customer from the premium list and add it to the platinum list.
To delete recipients from one recipient list and add them to another, set up the Delete recipient class (which deletes the customer from the premium list) along with the Upsert Apex class (which adds the customer to the platinum list). Configure the Delete recipient Apex class only with the recipientId and recipientListId parameters. See steps 18 and 19 in the previous section.
Enabling synchronization of deleted contacts, leads, and personal accounts
To completely delete deleted contacts, leads, and personal accounts from your recipient list in your Salesforce database as well, do not set up a separate process in Salesforce. The Salesforce add-on takes care of synchronizing your deleted Salesforce data sets if you enable automatic synchronization of deleted contacts, leads, and/or personal accounts. Perform the following steps:
- Open the Administration (Episerver Campaign) tab.
- In the Administration (Episerver Campaign) window, click Start scheduler under Synchronization of deleted recipients.
Click End to interrupt synchronization of the deleted data sets. This may be necessary, for example if the configuration is faulty, and you need to correct it.
Click Start under Synchronize manually to perform (one-time) manual data synchronization. A manual start lets you limit the period of access between Salesforce and Optimizely Campaign in the log files, thereby helping to diagnose any errors.