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:




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).


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







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:




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).





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:




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



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:



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


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





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:








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):




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):



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)









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


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