Spreading Holiday Cheer

Lizette CZ
7 min readDec 20, 2021

Salesforce Automations hard at work

Ever wonder how Santa’s elves get so much accomplished? The answer is Process and Automation! And that’s exactly why Salesforce is so effective. You can customize a process in Salesforce and create automations to help boost your User’s daily productivity.

Remember when Buddy only made 85 etch-a-sketches? Oh he felt so horrible when he had to tell Ming Ming. I imagine this is how a User feels when the process becomes “the job” to do their job — ooh, that’s heavy.

In the Talent Stacker project that Abby and I created, we built a lot of automations that supported The Giving Tree Foundation’s Donation Management process.

One of the requirements was to check an At-Risk field so the User could easily identify if the donor is active within the last 365 days or not. Being the smart and experienced Salesforce System Admin that we are, we also created 2 related fields as anticipated follow-up questions: At-Risk Reason and At-Risk Date. Don’t you want to know why and when this happened? Then, the client also wanted the following changes to occur:

  1. donor record “Owner” changes from Donation Manager to Program Manager
  2. notify the Program Manager that an At-Risk donor needs their attention
  3. an At-Risk banner appears at the top of the donor record page

These are a lot of manual steps for a Salesforce User to do. If you manage the process, the process can’t manage you. Take it from Santa, he uses Salesforce too and look how orderly and efficient his team is!

In order to automate this entire At-Risk process, we built a Schedule Triggered flow to identify all donors and automate the entire process.

In doing more research about this, it’s a best practices to run a scheduled triggered flow through Apex so we don’t run into record limitations, but this solution worked in this project because we had a limited # of records.

In the first step, we scheduled when the Flow should run by entering a Start Date, Start Time and Frequency. It runs every morning at 4AM — before anyone gets to work.

The first action element calculates how long ago the last donation was made, stores the calculated value into a variable, then uses the value in the variable to update the field on the record.

1st Update Records element

We created a formula variable called “DaysDifference” with a Number data type.

Create the Variable: Using formula: {!$Flow.CurrentDate} — {!$Record.npo02__LastCloseDate__c}

This data will be used to set the criteria in defining who is “At-Risk” in the next action element.

Update the custom field “Days Difference” on the Donor record by inputting the calculated value that is being stored in the “DaysDifference” variable

The second action is to update specific fields on the donor record if 2 criteria are met.

An At-Risk donors is someone who donated last year, but has not donated in the last 365 days. Criteria can be defined as:

  1. Last donation older than 365 days
  2. Donation Amount = $0

Since we created DaysDifference to help define the first criteria, we created another variable called “TotalGiftsNDays” and defaulted it to a currency value of $0 to define the second criteria.

Below — if both of these conditions are met (the system recognizes the donor as “At-Risk”), then it performs the updates that are specified in this element.

  1. If $ amount donated in the last 365 days is $0, then…Note: API npo02__OppAmountLastNDays__c is “Total Gifts Last N Days” field. It’s a rollup field in the NSPS that auto calculates the $ amount donated in the last 365 days. This field is defaulted to 365 so it worked out perfectly, but the “N” days can be customized.
  2. If the custom field “DaysDifference” is greater than 365, then…
If the record field “Total Gifts Last N Days” = $0 (TotalGiftsNDays) & DaysDifference is more than 365 days ago

then the system makes these updates on the donor record:

  1. enter the current date into the At-Risk Date field
  2. enter “No donation Past 365 days” into the At-Risk Reason field
  3. check the At-Risk field
  4. Change the value in the Owner field to Program Manager

You remember how this flow runs every morning to identify At-Risk donors, well if the donor does not meet the At-Risk conditions, it auto unchecks the At-Risk field too. How does that happen? Once the At-Risk donor makes a donation with the persuasion of the Program Manager, the $ amount will no longer be $0 and the DaysDifference will be less than 365. To reverse the actions of this flow, we created a Workflow Rule to recognize when the At-Risk field is unchecked (FALSE). The Workflow Rule resets the At-Risk Date and At-Risk Reason fields to blank and changes the donor record Owner back to the Donation Manager from the Program Manager. Boom, fully automated — although the Program Manager is still able to manually uncheck the At-Risk field too, but the Workflow Rule safeguards against the PM forgetting to do this!

Part of the requirement was to notify the Program Manager that a donor record was reassigned to them and they need to contact the donor within 24 hours with High priority, we created a separate flow on the Donor object to create this task.

The starting condition was set to run whenever a record was updated and the At-Risk field is checked (TRUE).

The first element was to Get Donor Record. (Remember, Donor =Contact):

Once the record is retrieved, then create a task to notify the *Assigned to ID (Program Manager) that *Subject (Donor At-Risk High Priority) regarding *Related Record ID and must be contacted by *Due Date Only (created variable Formula24Hours).

The “Formula24Hours” used in the Due Date Only is a Date/Time data type variable set 1 day from the current date using the formula: {!$Flow.CurrentDateTime} + (24/24)

{!$Flow.CurrentDateTime} + (24/24)

Voila — this is what the email notification to the Program Manager looks like:

Now, if you’re really paying attention, the “Priority” field is not available on the create New Task element because the field lives on a different object “Task” so we had to create another flow to update the Priority field to “High.”

This flow runs when a record is created and the Subject = Donor At-Risk (High Priority).

The first action is to Get Activity Record:

and the second element is to change the Priority to High every time a new Task record is created.

You might say, that was a lot of work to automate this requirement, but you just have do this once and aaaalll the Users get to benefit from it over and over and over and there’s no chance of donors being neglected. This makes Buddy very happy! More than Santa’s arrival and finding free gum.

Happy Holidays — see you next year!




Lizette CZ

Salesforce Magician + Home Chef Enthusiast + Fun Size = ME!