Have you ever had the need to send a weekly update email sharing specific data from CRM, but there isn’t any specific trigger you can use? Or, you want to send an email notification months or even years based on a date on a record? Rather than setting off lots of workflows with a timeout clause (which leaves you with lots of pending system jobs), how about scheduling recurring emails using a workflow instead?

This post shows how to do that using two solutions I use quite regularly. One is Workflow Scheduler by Lucas Alexander, and the other is Workflow Elements by Aiden Kaskela. We will use Workflow Elements in a workflow to get the results we want to add to an email, and us Workflow Scheduler to determine when the email gets sent and select our workflow to get the details.

I recently did a presentation all about Net Promoter Score, so tying in to that, I will create a weekly email which will give me the overall NPS for the organisation, and a list of the Promoters, Passives and Detractors for the previous week. The first thing to do is create some views. These can be system or personal views. I’ll create 4, one for the overall NPS information, then one for each of the contacts and the NPS type they could fall in to. Now I will create my workflow. The entity you run the workflow on is important. I only want to have one email go out with all details included, rather than running it once for every contact or account. So my workflow will run against the business unit entity. Make sure you set this to run as a child process and make sure nothing is ticked in the section for determining when it runs.

Next, we are going to add four steps choosing the ‘Query – Get Results’ option from the Workflow Elements solution we installed.

In the properties for each step, we need to define two things (you can use more of the settings of course if you wish). That’s going to be the table header background colour, and one of the views we created.

Once you have added all of the query elements, we then add a final step which is to send an email.

Create the body of the email, and for each step, use the local values and then get the results for each step you created previously (make sure you name the steps so that it’s obvious which results you are pulling in to the email.

You then need to make sure you pick Query Results (HTML) from the list of options for each value.

Now that the workflow is finished, make sure you activate it – then we can schedule it to run on a weekly basis. The first thing to do is open the Workflow Scheduler solution, then go to the Recurring process entity. Tick the settings box so that it will display in the menu. You can always add your new recurring process via Advanced Find, but this just makes it easier for you to find and access. Publish the solution and then refresh your screen. You should then be able to access this from the settings area of the menu.

We will give the recurring process a name, then type in the name of the entity to run the workflow against. We can then determine the frequency (hourly, daily or weekly). Finally, we need to add in a FetchXML query to determine which records to run the workflow against. This query can be created using Advanced Find, then clicking on the Download FetchXML button at the top of the query. Make sure you are 100% sure about your query. As mentioned, the query is used to determine which records to run the Workflow against (along with the entity type). So if you run something against an Account or Contact for example, the workflow you use will run for each record that the query returns. This is why in my instance it’s running against the business unit entity, and the query is set to only return the parent business unit, which will only give one record to run the workflow against.

Finally, test the process. Just set the date/time for a few minutes from that point and wait for the end result. Review it, make sure the email looks the way you want it to, then make sure to update the date and time for the next moment you want it to run!