Parseur allows to create as many templates as you have layouts to parse in a single mailbox. When you have more than one template in a mailbox, Parseur will pick the best one automatically, without any further config.

This article describes the standard template selection workflow and how you can tweak it if needed.

Standard template selection workflow

Here is how Parseur selects a matching template for a document.

By design, Parseur can only use a template if it matches 100%. You can check the match ratio of a template using the template debugger.

Step 1: A new document arrives in the mailbox

Step 2: Does the mailbox have zero custom fields and one or more Extra fields?

  • YES: extract data from the document using Extra fields only and set the document status to "Processed" END.
  • NO: Go to Step 3.

Step 3: Is there one or more templates in the mailbox that matches 100%?

  • YES: Pick the template with the most fields(1). If there are more than one template with the most fields, pick the first one we find. Go to Step 8
  • NO: Go to Step 4

(1) how Parseur counts fields:

  • every standard field counts as 1.
  • every table field counts as the number of columns in the table
  • every field with the "Full Name" format counts as 3
  • every field with the "Address" format counts as 6

Step 4: Is the mailbox of a special type (food ordering, real estate, i.e. NOT a custom mailbox)

  • YES: Go to Step 5
  • NO: Go to Step 6

Step 5. Is there a matching template in the linked mailbox managed by Parseur?

  • YES. Pick that template. Go to Step 8
  • NO: Go to Step 6

Step 6: Is the document a spreadsheet or CSV?

  • YES: automatically extract table data from the document. END.
  • NO: Parseur doesn't know what to do with the document. Set Status to "New Template Needed". END.

Step 8: Use to selected template to extract the data and set the document status to "Processed". END.

Can I override a "managed by Parseur" template?

Yes. As described in the workflow above, your local templates always take priority over templates managed by Parseur.

To override a "managed by Parseur" template, simply create a new template locally in your mailbox.

How can I force Parseur to choose another template?

In some cases, the template selection workflow leads to Parseur choosing the wrong template. When this happens, you can tweak the template selection process in several ways.

Option #1: Create a new template with more fields for this type of documents

This can be a good solution if you hadn't created a template yet for this document but it is very similar to an existing document that contains less fields to extract.

Create a new template based on the new document to capture more fields.

Option #2: Edit an existing matching template to capture more fields than the current matching template

This is a good solution if the template you wanted Parseur to pick contains less fields than the one that got picked AND if you can add more fields to the template you want this document to match.

Option #3: Add fields constraints to the wrongly matched template to prevent it from matching the current document.

As their name suggests, field constraints are designed to constrain a particular field to follow a certain pattern.

Example: let's say you have created a template that matches pickup orders made at your restaurant. Unfortunately that template also matches delivery orders at the restaurant. You don't want that to happen because you need to extract other types of information in the email for delivery orders.

To make sure the pickup template only matches pickup orders:

  • Edit the pickup template
  • If you don't have one already, create an orderType field to capture the PICKUP mention in the email
  • Click on the Edit icon button next to the orderType field
  • Open the Advanced Options panel
  • Set the field constraint to "Exact match"
  • Save the field
  • Update the template

Now, that template will only be used if the orderType field contains the word PICKUP. If not, priority will be given back to another template for emails containing DELIVERY (for example) in the orderType.

Did this answer your question?