MatchRules

Route Leads and Other Records based on MatchRules

Last published at: October 10th, 2024

In this article, whenever we talk about 'leads' we are referring to any record from any object that you are assigning via SuperRoundRobin.

MatchRules are what governs whether a lead gets distributed to the Assignees in that MatchGroup. A few concepts:

  • MatchGroup with no MatchRules will receive all the leads (unless it is lower priority than another matching MatchGroup)
  • MatchGroup can have several MatchRules
  • Multiple MatchRules can be evaluated with AND or OR logic - set at the MatchGroup level
  • Custom MatchRule Logic can be specified when 3 or more MatchRules are used e.g. (1 AND (2 OR 3))
  • MatchRule can be created based on fields on the record being assigned (e.g. the Lead) or on parent record fields (e.g. if you are assigning Cases, you could create a MatchRule based on the Account Name).

A common request is can I use custom fields? Yes - the custom fields will automatically be populated in the Field picklist.

Here is an example MatchRule that is set to match leads that have the Leadsource value = 'web'. As this MatchRule belongs to the 'Web Sales Team' any matching leads will be distributed to Assignees in that MatchGroup.

Here is an example showing the selection of a cross-object field - this is a Case MatchRule that references the Industry field on the Parent Account record:

Let's have a look at each field in turn

  • MatchRule Name: It's a good idea to give this a name that describes exactly what this MatchRule is doing
  • Field: This is the field on the Lead record that will be evaluated. All fields including custom fields will appear in this picklist. If you select a lookup to another object, then another picklist will appear below that allows you to select a field from the parent object (e.g. Case >> Account.Industry)
  • NOT: Use this to reverse the logic. In the example above, if you checked this box it would match leads that did NOT have a Leadsource == web.
  • Operator: This can be either EQUALS, CONTAINS, STARTSWITH, ENDSWITH GREATERTHAN or LESSTHAN. Use the GREATERTHAN and LESSTHAN operators for comparing numerical fields. (Don't see STARTSWITH or ENDSWITH?
  • MatchingValue: This is the value you are comparing to the value of the field you selected in Field. You have several options here.
    • Supply a list using the pipe | symbol. e.g. Using EQUALS web|linkedin|hubspot|leadfeeder will match any of those items (it does an OR match the items in the list)
    • Zipcodes can be done this way as well e.g. 90210|90214|90222|90234...etc. You can fit all the zipcodes in Florida in there if you wish!
    • You can use the STARTSWITH operator to match the first two or three digits of a zipcode e.g. 324|325|325 will match any zipcode in the north-east counties of Florida.
    • Use the <empty> keyword if you want a match a blank value
    • If you are matching against Picklist values, use the API Name in the rule for the picklist item you want to match against.

So in this example, the Picklist Values (Tier1, Tier2, Tier3) are what appear on the UI and available for the user to select in the drop down. Usually the Values and the API Name will default to the same thing. If they are different, you need to use the API Name in the MatchingValue field as below:


Now let's look at combining MatchRules

Let’s say we have a team of six sales agents who are responsible for Florida leads from a Spanish web form.

For this MatchGroup we create two MatchRules, one where the State is Florida and the other specifying the Leadsource as ‘spanish_form’

To finish off we need to specify whether these three MatchRules are to be evaluated as OR or AND. Clearly in this situation we need to use AND because we are looking for leads that match both rules.

Custom MatchRule Logic

Following through on this example, let's say that there is another source of Spanish-speaking leads, but not necessarily from the Spanish web form. These leads have the Language field set to 'spanish'.

Now we have three MatchRules and we need to specify custom logic where we want to match leads from Florida, where either the language specified is Spanish or the leadsource is 'spanish_form'. Select "Custom Logic" in the picklist and specify the Custom MatchRule Logic: 1 AND (2 OR 3)

Notice that each MatchRule has a Rule Number field, with the value highlighted as a number with blue background. These are the numbers that are used in the Custom MatchRule Logic. So in this case, we would need to specify (1 AND (2 OR 3)) as the logic - where 1 represents Rule Number 1 (State=Florida), 2 represents Rule Number 2 (Leadsource=spanish_form) and 3 represents Rule Number 3 (Language=spanish).

There is a known bug with Custom MatchRule Logic when nested expressions are used and extra spaces are present - for example: (1 AND 2 AND ( 3 OR 4)) will fail because of the extra space before the 3. By removing the extra space before the 3 it will work as expected: (1 AND 2 AND (3 OR 4))