Salesforce Connector: Customizing the "Add to Campaign" Feature [Advanced]

While the BrightTALK Connector for Salesforce comes with a built-in feature to add leads and contacts to Campaigns, we know there are use cases that require editing or modifying this feature to achieve new outcomes (such as custom program statuses, preventing leads from syncing to campaigns, better error handling etc.). 

To help you achieve your desired outcome, this article will show how to create a custom version of this feature using Salesforce "Flows."  While this may look daunting, it should only take about 15-20 minutes to complete.  

Note: That said, we suggest this only be done by a trained Salesforce Admin, as BrightTALK's support team will not be able to assist with specific questions on how Flows work and operate.

 

Here's what a completed flow diagram looks like- follow the steps below to recreate this:

Screen_Shot_2021-08-24_at_9.16.55_AM.png

 

 

Table of Contents

Step 1: Create a custom field to calculate the member status

Step 2: Define the flow trigger and assign the record values to variables

Step 3: Add the Lead/Contact Decision

Step 4: Create the campaign assignment rules for leads and contacts

 

 

 

 

Step 1: Create a custom field to calculate the Member Status


While technically you could derive the member status in the flow itself, we find it much easier to just quickly create a custom field on the "BrightTALK Subscriber Activity" for this.  This should be a text formula field and should look like this.

Note 1: the values in the single quotes should be the program statuses you are using):

Note 2:  We called this field "Activity Type" but that is not required (although keep that in mind later for the Flow steps).


Formula:

IF( BrightTALK__Recorded_Viewings__c > 0, 'Viewed On-demand',
IF( BrightTALK__Live_Viewings__c > 0, 'Viewed Live', 'Registered'))

 

In SFDC:

Screen_Shot_2021-09-07_at_3.55.28_PM.png

 

 

 

Step 2: Define the flow trigger and assign the record values to variables

 

Now we'll create the Flow.   This is going to a "Trigger-based" flow and we'll set it up ourselves (no pre-built SFDC template).  Here's what that trigger should look like:

Screen_Shot_2021-08-24_at_9.17.20_AM.png

Screen_Shot_2021-08-24_at_9.17.29_AM.png

 


Next, we'll connect two "Get records" steps to this flow

The first one will get the current lead/contact record (i.e. whoever we are adding to the Campaign) and assign some of their field values to variables (so we can reference them again later in the Flow).

Screen_Shot_2021-08-24_at_9.17.40_AM.png

Screen_Shot_2021-08-24_at_9.17.47_AM.png

 

 

The second one will get the Campaign Reference value for this lead and webinar- this is the Campaign Id value you provide from the BrightTALK platform and should also be stored as a variable:

Screen_Shot_2021-08-24_at_9.17.58_AM.png

Screen_Shot_2021-08-24_at_9.18.06_AM.png

 

Here is what your Flow should look like after this step:

Screen_Shot_2021-09-07_at_4.47.49_PM.png

 

Step 3: Add the Lead/Contact Decision


Now we'll need to define if this is a Lead or a Contact, as that will impact how the record gets added to the Campaign.  You can do this by adding two Decision checks.

One to check if this is a Contact:

Screen_Shot_2021-08-24_at_9.18.16_AM.png 

 

And a Second (off the "Default outcome" branch) to verify that it's a "Lead" with the right fields:

Screen_Shot_2021-08-24_at_9.18.25_AM.png

With these decisions added, your flow should now look like this:

Screen_Shot_2021-09-07_at_4.59.49_PM.png

 

 

 

Step 4: 

We'll now need to route these leads and contacts to the correct path.  Note: From this point onwards, all steps need to be done twice- once for the Contact path and again for the Lead path.  If you do not wish to add leads to Campaigns, simply have the lead decision tree output to nothing.

First, add a Get records step to both the Contact and Lead branches:

Contact
Screen_Shot_2021-08-24_at_9.18.35_AM.png

Screen_Shot_2021-08-24_at_9.18.42_AM.png

 

Lead

Screen_Shot_2021-08-24_at_9.19.41_AM.png

Screen_Shot_2021-08-24_at_9.18.42_AM.png

 

Second, add a Decision step to both branches to verify if the Lead/Contact is currently in the Campaign (note the logic on here is identical for both branches):

Screen_Shot_2021-08-24_at_9.18.49_AM.png

 

 

This decision should point to two potential outcomes:


If the decision criteria is met (Lead/Contact exists in Campaign), then the outcome should be to do an "Update Records" on the Campaign Member (to set the status):

Screen_Shot_2021-08-24_at_9.19.25_AM.png

Screen_Shot_2021-08-24_at_9.19.30_AM.png



If the decision criteria is not met (the default path), then the outcome should be to do a "Create Record" on the Campaign Member (to add and set the status)

 

Contact

Screen_Shot_2021-08-24_at_9.19.14_AM.png

Lead

 

Screen_Shot_2021-08-24_at_9.20.09_AM.png

 

 

And that's it- your completed flow should look like this:

Screen_Shot_2021-08-24_at_9.16.55_AM.png


Here's what it does in layman's terms:

1. Every time a new record gets added or updated in the BrightTALK custom object, this process runs

2. When that happens, it checks if it's a lead or a contact

3. Finally it adds it to a specific campaign (or updates it if it's already in that campaign)

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request