Latest builds of v3.2 provides new capabilities such as nesting rules or actions. Make sure you upgrade the build to the latest before you proceed to read through this blog post.
This blog post explores how you can nest rules or nest actions like a PRO.
Preface – Processing emails with Global filters offers the ability to save emails or attachments into different folders based on some criteria and take actions on them.
You do not need to learn about nesting (described here) for most common cases. Nesting is only useful for advanced cases.
If you are not familiar yet with the Global filters, we have a great blog post here that should help you get started.
Proceed to read on only if you are familiar with how Global filters work.STOP here and read through this blog post to familiarize yourself with Global filters
This post is about how nesting rules can come in handy when you want to cover some advanced scenarios. Some examples where this can be useful include:
- When no rules match for a specific email, perform certain actions such as move emails to an error folder that you can take a look at.
- When you may have multiple attachments in an email each of which have different possible actions.
- When you want to share a set of actions or email filters amongst many rules so you don’t have to re-type them all over again.
The global filters tab in the PRO versions offer you the ability to define three types of rule filters: an Email Filter, a Global Rule or a Negative Rule, Shared Action. The Rule Type dropdown (shown below) enables you to select the type of the rule.
Read on to explore the different rule types below by using an example.
Tutorial with an Example….
Example: Consider an example where we want to target all emails that have the term “Invoice ID” in the Subject. We also want to move the .pdf’s in such emails to a PDF prefixed folder and .doc’s in such emails to another folder prefixed by doc. Also, if no pdf or doc’s are present, we’ll move the email to an “Issues” folder. And lastly we want to use a Shared Action to save the doc/pdf related email header data (from/to/subject etc.) to a database.
Let’s start by creating a new Email Filter.
Go to the Global filters tab and Add new, in the popup select the Rule Type as shown above and change it to Email Filter if it’s not already selected.
Email Filter: This enables you to instruct the program to filter processing to either a specific email or to target a group of emails matching the filters you specify here. This rule does not, in and of itself, enable you to save emails or attachments to folders or even define actions that you can take after saving files. Those sections will show up disabled as a result.Read on to see how Email Filters can have Global Rules as child rules…
You can then save this rule and it’ll show up in the Global filters tab as shown below.
Global Rule: This type of rule enables you to specify which attachments you want to filter down to and where to save them. It also enables you to define actions that you can take after saving the file. You can define a Global Rule as a standalone rule (at the root level) or as a child of an Email Filter.Read on to see how you can setup multiple Global Rule‘s to save files to different folders
To create a Global Rule as a child of an Email Filter, right click on the email filter and add a new Global rule as shown below.
Let’s have this rule save the email attachments that are PDFs to a “PDF” folder. This has a filter of Attachment count greater than and a filename option of pdf.
Since this is a “child rule” of the Email Filter we defined above, the Global Rule will only run for emails with a subject that contains “Invoice ID” that we defined earlier. We have also setup a Mark as read action as shown above. You can add any other action like Move email to folder to move the email to a different folder if you want.
Now, let’s define another Global Rule that saves .doc or .docx’s into a different folder. Right click again on the Email Filter in the Global filters tab and select Add new -> Global Rule. Setup the Global Rule as shown below.
At this point you should see Global filters tab as shown below (Email Filter being the parent with two child Global Rules).
Negative Rule: This type of rule lets you specify “catch-all” actions when none of the Global Rules match. To do this, we will right click on the Email Filter again and select Add new -> Negative Rule. This type of rule doesn’t offer you the ability to save anything (this will show up disabled).Read on how to setup a Negative Rule under an Email Filter as a “catch-all” rule
Let’s now configure the Negative Rule to copy the email to the “Issues” mailbox folder.
Lastly, lets create a Shared Action. Go to the Global filters tab and right click anywhere (not on the Email Filter like we did earlier as Shared Action will show up disabled if you do that). Then select Add new -> Shared Action.
Shared Action: This type of rule has no save options enabled but will have additional filters or actions that you can define. These actions are those that you want to share amongst many Global Rules.Read on to see how to use a Shared Action to save email data to a DB
We’ll create a new Shared Action as shown below.
To configure the program to save to a database, refer to this blog post. We won’t show that here.
Now let’s add this Shared Action to the Global Rules we defined earlier. Multi-select the two rules in the filter tab and then right click and select Add ‘Shared Action’ to selected option as shown below.
In the popup that follows, select the shared action we called “Save emails to a database” and click OK.
Summary of the final setup for the example
Now we have setup rules to process the emails with the Invoice ID in the Subject with the Email Filter. Then configured child Global Rules to save PDF and DOC attachments to different folders. We also defined a Negative Rule that moves the email to an ‘Issues’ folder when no attachment arrives. Lastly, we configured a Shared Action for the Global Rules to save the email data to a database.Nesting rules are a great way to take advanced actions
Similarly you can nest actions inside a rule as shown below after saving the attachment.
The below shows how you can unzip a file, do a document conversion and then save to a database and run a command line operation.
For more on this, read this blog post here.