Examples of Different Field Types in MatchRules

How to match against checkboxes, date fields, etc

Ed Ralph

Last Update il y a 3 ans

It is likely that you want to segment your records based on the value of various field types.  This guide tabulates all the Salesforce field types and how you can use them in MatchRules.

Notes:

  • The <empty> keyword can be used with any field type except Checkbox to test whether the value is either null or an empty string
  • When GREATERTHAN and LESSTHAN operators are used, an empty value is treated as a zero
  • Specify a list by separating items with a pipe ( | ) character



Field TypeUsage in MatchRules
Auto NumberUnlikely candidate for a matching rule; treat it as text.
FormulaLook at the return type of the formula field and treat it as if it were a regular field of that type. So for example, if the return type is Percent, refer to the Percent field below for guidance.
Roll-up SummaryThis field type returns a number; so treat as such.
Lookup RelationshipThe content of this field is the Id of the related record. If you want to match records where there is no relationship set, you can use the empty keyword. You cannot 'query across' into the other related record and match based on values in the related record. To achieve this you should create a formula field that looks up the desired field of the related record and use the formula field in your MatchRule.
External RelationshipAn External Relationship is a field for creating parent child relationships with objects external to Salesforce.  The Salesforce object with the External Relationship becomes the child in this relationship and contains the identifier of the external record stored as a String.
CheckboxThe value can be either TRUE or FALSE (corresponding to checked / unchecked).  It is never null so the empty keyword has no effect.  Either TRUE or FALSE should be entered into MatchingValueXL in the MatchRule.
CurrencyCurrency is a Decimal datatype.  SuperRoundRobin rounds the Decimal value down to a whole number and can be used with any of the MatchRule Operators.  As such be aware that $0.99 will be rounded down to zero; in a future update we expect to modify the code to keep the data type as Decimal so no rounding takes place.  Let us know if you need this.
DateTo use a date field in your MatchRule you must create a formula field that returns either a number or text that can be used in the MatchRule. For example, a formula field with the formula: (TODAY() - CreatedDate) will return the number of days since the record was created. That formula field could then be used in a MatchRule to test whether the record is more than X days old using the GREATERTHAN operator. Or you can test for day of week as described in this article: https://superroundrobin.tawk.help/article/route-leads-based-on-day-of-week
DateTimeAgain, as with Date, use a formula field to return a number or text value that can be used in the MatchRule.
EmailCompare as you would regular text with the EQUALS or CONTAINS operators. Match on a domain using CONTAINS @thedomain.com. Match a list of domains by separating with a pipe character: CONTAINS @firstdomain.com|@seconddomain.com|@thirddomain.com. See screenshot below.
GeolocationThis is a compound field and can be used in several ways. The most likely scenario for a Geolocation field is to combine it with a formula field that uses the DISTANCE and GEOLOCATION functions to return the distance between the geolocation coordinates in the record and a fixed location. For example, the following formula returns the distance in miles between the geolcation_field__c and Cambridge, UK: DISTANCE(geolocation_field__c, GEOLOCATION(52.2053,0.1218), "mi"). Then you could use it with a LESSTHAN operator to match records where the location is within 50 miles of a certain location.
NumberMost often used with the GREATERTHAN or LESSTHAN operators.  Of course it could be used with EQUALS as well.
PercentThe Percent value will be rounded down to a whole number and you would use it as you would a number. Beware that 0.99% will be rounded down to zero. A future update will address this - let us know if you need it now.
PhoneTreat as text. Beware this field accepts various phone number format characters such as hyphens and brackets.
PicklistPicklists value set items have a Value and an API Name.  Usually the Value and the API Name are the same, but if they are different make sure you use the API Name in your MatchRule.  See screenshots below.
Multiselect PicklistThese are treated the same as Picklists with the added complication that if multiple items are selected, the items are delimited by a semi-colon.  See examples below.
TextUse the EQUALS or CONTAINS operators to match text.  The pipe character is used to delimit items such as state codes: TX|FL|CA|AZ
Text (Encrypted)With an encrypted text field, the value is encrypted when the server saves the data. Because SuperRoundRobin processes the data before it is saved, it can read the values put into this field (!). When a record is subsequently updated, the content is encrypted and SuperRoundRobin will not be able to match it. But for new incoming records, you could create a MatchRule that uses this field type. Use case here might be to assign on the basis of the first three numbers of a Social Security number.
TimeSimilar to a Date field; use formula fields to manipulate the date into returning a number or text that can be matched by SuperRoundRobin.
URLTreat as text. Check the notes against the Email field type as these are essentially the same type of field.

A MatchRule that matches any walmart domain in the email field:

Picklist Value Sets - use the API Name from the value entry:

For a multi picklist like this one below...

To create a MatchRule that matches records where 'One' AND 'Three' have been selected, use the following (note the semi-colon between 'one' and 'three'.  These should be in the order the picklist values are defined):

If you wanted to match on 'One' OR 'Three' you would create two MatchRules:


Special considerations when Enabling Country / State Picklist

A default Salesforce org has Country and State fields as regular Text fields.  MatchRules that use the Country and State fields work as expected.  However, when the org administrator decides to Enable Country and State Picklist the Country and State fields no longer work in certain circumstances.  This is due to a known issue where the Country and State value is not available to any BEFORE triggers when the record is created in the UI.


When to use Country/State vs CountryCode/StateCode

  • If the record is created through the UI, use the CountryCode/StateCode fields
  • If the record is created via Web to Lead, check if the Country field is set or the CountryCode.  Use the appropriate field in your MatchRule (in the Web to Lead form, the CountryCode field name is country_code).
  • If the record is created via an external system, again check if the full Country/State fields are set or the 2 letter CountryCode/StateCode fields.  Again, use the appropriate field in the MatchRule.

 

The 2 letter CountryCode / StateCode fields are different depending on the object - check the table below:

ObjectCountry Field To UseState Field To Use
LeadCountryCodeStateCode
AccountMailingCountryCodeMailingStateCode
ContactMailingCountryCodeMailingStateCode

Was this article helpful?

2 out of 2 liked this article

Still need help? Message Us