Employed for Good

Tech tips for impact professionals. Do well at doing good.

How to Build Monthly (or anytime) User-Scheduled, Scheduled Flows


I know, the title is a mouthful. It’s the best I’ve got.

Last year, I moved into a job with a new-ish but complex Salesforce org (think custom apex and subflows-within-subflows). The occasion called for learning everything I could about Flows.

Once I learned Salesforce would no longer support the other automation baddies, I got even more serious. I’ve learned a ton, and it’s all been great. (But I’ll always love you, workflow rules.)

Today’s post highlights one of my prouder Flowcomplishments. So whether you’re trying to get your feet wet with Flows, or if a frantic Google search brought you here, it’s all the same. You are among friends!

The Issue:

If you’ve ever used Scheduled Flows, then you know it’s only possible to schedule recurring Flows on a daily or weekly basis. There’s no monthly option, and the other alternative is to schedule Flows on a one-time basis.

For our monthly email process, I needed a Flow that could kick off monthly. But if I’m being honest, I also needed flexibility to push those dates back (you know, because life).

Up until now, my only option was to go into that scheduled Flow and manually set the run date each month. But creating and activating (and later deleting) Flow versions each month just left me thinking:

Credit: Giphy (Blackish)

The other issue is that this step – and thereby our entire monthly process – relied on admin intervention. For that day when I win the lottery or hopefully go on vacation again, someone else needs to be able to step in and handle this thing!

To recap, I wanted a solution that could:

  • Run my Flow process on a monthly basis
  • Allow for date flexibility
  • Have the ability to be modified by an end user

Solution Overview

Highlights below. For those who’d benefit from seeing the full walkthrough, here’s a video with all of the steps.

1) I created a custom object, to serve as the trigger for my scheduled flows. I named it “Trigger” (not a creative day for me) and added the following fields:

  • Flow Run Date (date) – for scheduling my flow’s run date
  • Trigger Type (picklist) – for categorizing the business process related to that trigger. #organization
  • Active (checkbox) – for activating/de-activating the trigger record (slash Flow)
  • A text field, for describing the record. I just used the default Name field for this, but if you use the auto-number option, you’ll want to add a second text field

2) Next, I created a Trigger record for our monthly process. I marked it Active, added a Flow Run Date and grabbed the record Id.

Sample Trigger record from my Dev org

3) Then, I created a scheduled Flow to run daily (right after midnight), based on my Trigger record.

In my Start element, I added criteria to check for the specific record Id and the Active status.

4) After my Start element, I added a Decision element. This checks if the Flow Run Date is equal to the date on my Trigger record.

  • If the dates match, the Flow proceeds. (I did have to reconfigure the rest of the Flow, but I won’t get into that here since it’s out of scope for the solution)
  • If the dates don’t match, the Flow ends and tries again tomorrow

5) Assuming the Flow runs, the last step is an Update element that assigns the Flow Run Date on the Trigger $record with the next month’s date.

That’s it! If you’re feeling lost, here’s that video link again.

  • Note this video has a demo Flow setup. (It doesn’t have my org’s actual monthly process Flow, because that would be a beast to reproduce & explain!)

What I like about this solution

1. Less flow versions – If I can spare myself the Setup>Flows>[Flow Name]>Save As>Activate dance, then I’ve saved myself what feels like a small eternity of clicks each month.

2. A user can schedule this now – I’m still the lead on this process, but I like that it adds room for delegating. Once I can refine some other pieces, maybe this process won’t have to live with me.

3. Room for future use cases – now that the Trigger object setup is done, I can always create a new Trigger record & Scheduled Flow when the need arises.

Caveats

1. Flows that run needlessly every day – It’s not my favorite thing in the world to have a flow kick off daily when I only need it once a month. (I like to keep a tidy automation shop, sometimes to my detriment). But our database size isn’t massive, and the benefits currently outweigh any of the hidden costs.

2. This setup doesn’t allow specifying run time – Since my Flow always runs after midnight, I don’t get to use my Trigger object to change that time slot. It’s a small price to pay for our use case, and just means the Flow Run Date always needs to be set at least one day before.

3. Finalizing that monthly date formula – I still need to work out the perfect date formula for setting the cadence on our Trigger record. The formula in the video (for those who watched) is not the one I’m using in my real org, but that’s because I haven’t made time to really work out all the kinks (for ex. making sure it always falls within a certain date range)

4. This only works for a small database size – once our org gets past a certain number of records, I know this Flow is likely to fail. But at the very least, it’s a blueprint that I’m sure I’ll need to optimize fairly soon

Wrapping Up

In the name of research, here are some other articles for building out monthly Flows:

And if you’ve done this another way, or have questions/ideas, please do drop those notes in the comments!


Related Posts


Share your thoughts!

%d bloggers like this: