Sporadic Notes on Flow and Marketing Attribution

I’ve been working in Salesforce Flow…a lot. I am a novice but have really enjoyed learning about software development best practices through a point-and-click tool.

My use case has been the very simple (sarcasm) marketing problem of attribution.

We send out emails with the call to action to donate. We segment our audiences based on whether they’ve donated in the past year, previous years’ donations, etc. and send different campaigns to each segmented group. I’d like to be able to understand roughly how much money came from each campaign.

“Use campaign influence!” you say. However, it is clear as dirt to me how to set that up or what it even does, so I’m going to do this my way by creating a flow that will probably hit all the governor limits.

So, for starters/background, we use Cazoomi Syncapps to sync Mailchimp with Salesforce.

Here’s how it works:

  1. We send out an email to a group of people via Mailchimp. This segment could be created in Mailchimp or Cazoomi (which has a Salesforce > Mailchimp sync option)
  2. Cazoomi automatically creates a campaignand campaign members for each person who received the email in Salesforce.
  3. Cazoomi also syncs open and click rates into Salesforce

What Cazoomi doesn’t do is track conversions of donations. We have relied on Google Analytics to do this.

So here’s my flow building process…

  1. Describe the actions in English, as if a human was doing it.
    1. Start with a donation. Which donations are included? Just won ones coming in from online.
    2. Look to the donor name.
    3. See if the donor received any emails for this end-of-year campaign.
    4. See if those emails happened before the close date of the opportunity so that we can be somewhat confident of the attribution.
    5. Find the closest campaign member and update the donation/opportunity with that campaign.
  2. Translate the above notes to fields and limitations. For instance, for step #1, I filtered out anything that didn’t come in from online and wasn’t Closed Won.
  3. Build out the flow, keeping in mind limitations of the flow function and its quirks. Some notes I found were:
      1. Within the GET function, I’d love to be able to query on multiple levels using dot notation. For instance, it would be great to be able to find all Campaign Members where the Parent Campaign is “End of Year Campaign”.
      2. I can’t find all of the campaign members and store them to a variable, and then find all of the campaign IDs and store them to a variable; I have to use a loop.
    2. TIPS:
      1. When I am building for one record, if you are planning to scale up the flow, a good hint is to actually create a record variable for that record. Then, when it comes time to edit the flow to perform on a group of records, attempt to delete that record variable. It will show you a list of everything you have to replace.
      2. Name the variables with what type they are (e.g. Updated_opps_collection or Initial_opp_single_var)
      3. In my flow, I had to use an integer variable to figure out the closest campaign date to the close date (without going over). If I change this flow to operate on multiple Donation records, I will need to clear this value with every iteration of the loop.
  4. Debug using the Debug option.
  5. Create a button that deploys the flow.
  6. Deploy using a change set.

This is my final solution (adapted to be a nightly scheduled flow, which I haven’t tested yet). In the automated Tips section of the flow it says that I shouldn’t be doing database queries within a loop but I’m not sure how to avoid that in this case:

I also tried to figure out how to get this attribution to happen in bulk from a campaign but kept running into SOQL query limits, so I am probably doing something wrong.

In a different post, I will explain my interpretation of each type of action in flow to try to help others decode it. Stay tuned.

One thought on “Sporadic Notes on Flow and Marketing Attribution

Comments are closed.