Let me start with saying that Time Based Workflow is a great tool. It allows you to do things like schedule a follow-up task two days after the creation of a new Lead or notify a sales manager when an Opportunity has gone un-touched by a rep for a specified amount of time. But what about those times when you need something scheduled, not based on something else but truly scheduled, daily, weekly, monthly, etc?
If you are REALLY clever you MIGHT be able to hack something together with multiple date fields and multiple workflows/time based workflows. If you are a developer you could certainly write scheduled Apex triggers. If you have budget for third-party apps you might check out some available on the AppExchange. If you don’t fall into those categories you need to look at Workato. Yes, its in the AppExchange and yes they offer premium tiers but you can get started and fulfil this use case with the free version. When combined with Process Builder or Workflow we can put together some really powerful stuff.
Speaking of use cases, I recently helped a client with the following. A subset of their customer base has a recurring monthly charge that is paid via ACH. Their ACH processing does not automatically email a receipt which their clients need for documentation. The client doesn’t create a new Opportunity for each monthly transaction (otherwise we could have used Workflow/Process Builder to send the email based on a Closed Won status). They have simplified the process which I highly encourage all of our clients to do regardless of the situation they are tackling. In my client’s case simplicity meant a checkbox on the Contact object denoting who needs this receipt sent on a monthly basis.
Cool, but how does that help us send a monthly email?
Before we get started with the automation in Workato you will need to do some prep work in your Salesforce org. Determine what fields you are going to use to drive the actions. In my dev org I have built two custom checkbox fields:
1. Receive Monthly Email
2. Send Monthly Email
Spoiler Alert – here’s how this is going to work.
We will use Workato to search for all Contacts that have the Receive Monthly Email checkbox marked as True and will then update the Send Monthly Email checkbox for those Contacts to True as well. Workato will perform this on a monthly basis without us having to do anything to keep it going. Finally, we will use Process Builder to send an email template to the Contacts when the Send Monthly Email box is true, then un-check the box so that the process can fire again next month. That last step is critical to this continuing every month.
If you haven’t already, head over to Workato and sign up for a free account.
Establish your connection to Salesforce. Check out this video if you need help. For this recipe you will only need to enable a connection to Salesforce, feel free to add others while you are setting this one up.
Now lets create the recipe.
Step 1 is to define our trigger. We must select the app and define the event.
While we are ultimately taking action in Salesforce this is not the app we need to select for our trigger. Select the Clock function which is one of the things that separates Workato from the other automation tools in Salesforce.
With Clock selected as our application we can choose between a timer event or a scheduled task. For this use case select New timer event. Next, specify the frequency. This can run as frequent as every five minutes or as infrequent as once per month. Finally, tell Workato when you want the recipe to start running. You can leave it blank if you want it to run immediately upon completion of the process. Because I want this to run once a month I have set the start date to the first day of the next month.
On a side note, for testing purposes you may want to set the frequency (step 3) to something really short like every 5 minutes.
With that complete we can start building our Action.
On the screen that follows select Salesforce as your app. Next, select Search Objects. Note that when you go through the Action picklist you will see an option called Search Contacts. While it is logical to select this its function is very different. This will allow you to look for a specific contact either by record ID or by full name which wont work for this use case but might be perfect for others.
Once you have selected Search Objects in the Action box move on to the Search For box and select Contact.
With our Search action complete we need to specify the criteria that is being searched for.
Add a new Conditional Action.
On the right side of the screen scroll through the Search objects list for the field used for filtering. In this case we need to filter for the field Receive Monthly Email with a condition of is true.
With the Search action complete add a new Repeat Action. This will use the results from the search to drive our action for all records that meet the criteria.
On the right side of the screen expand the Search Objects section and click Contacts. This will add your search to the Input list.
Next we need to map our Contact ID from the Foreach step so that Workato knows which Contact records to update.
Scroll down (or use your browsers search function – cmd+f for the Mac crowd and ctrl+f for you Windows users) until you find your field. In this case we are looking for Send Monthly Email and want to change the value to Yes. Note that Yes equates to True in Salesforce speak.
Name, add a description and save the recipe. Hold off activating it until you have built the Email Notification and Process to send it. When collapsed, the lines should look like the screenshot below.
At this point Workato has done its job, at least for those of us on Enterprise edition or higher. For readers who are on Professional edition you could complete the sending of the email through Workato’s email function or by having Workato trigger the send of an email via Gmail. Note that if you use Workato to send the email it will come “from” Workato which may not be great for external facing communications.
The following is not meant to be an exhaustive overview of Email Alerts and Process Builder. There are tons of resources online for both of these. I will assume that you have a basic knowledge of how these tools work and will give a high level overview of how we use these in conjunction with our Workato recipe.
First create your email template then create a Workflow Email Alert on the Contact object. Your Email Alert will look something like this.
With your email alert built its time to move into Process Builder. You could just as easily use Workflow to do this, however, I recommend that any new automation being created be done in Process Builder so long as it supports your use case.
Your start element will take place on the Contact object and should be applied when a record is created or edited.
Now its time to define your criteria. In our two checkbox solution it is easy to get confused as to which one should be used to fire our email. We want to use the field that Workato is updating – Send Monthly Email equals True.
Add an immediate action – in this case an Email Alert. Select the email alert from our previous step then add another Immediate Action.
Remember that the Send Monthly Email field is the one that triggers our email alert. Workato is updating that field for us in the earlier steps. Process Builder isn’t going to fire again next month if the box is still True – it is dependent on a change from False to True. Create a new field update to change the Send Monthly Email field back to false. In other words, the field will be True just long enough to trigger the sending of the email then revert back to False.
With this complete go ahead and start running some tests.
First – and this is true regardless of what you are building – test in a non-production environment. If you have Enterprise edition or higher use your Sandbox. If you are on Professional Edition (you wont be able to use Process Builder or Workflow as we do in this use case) be sure to test in a free developer org which you can get here. The last thing you want to do is send a bunch of emails to actual contacts.
Second – as another way to check that things are working as intended, add the custom fields that you created in the prep section to your field history tracking. Schedule something on your task list or calendar to review some records on the day that your action is supposed to run. By looking at the field history and date stamps you will be able to confirm that you recipe is working as intended.
This exact use case isn’t going to be applicable to everyone but hopefully you have a way to use something like this. So, what will you build? Use the comments below to tell us about your first project.