Assign According to UK Postcode Areas

Last published at: 2024-08-01 08:14:52 UTC

UK post codes are arbitrarily complex and if you want to distribute records to reps by territory, often using the whole post code leads to clumsy MatchRules with thousands of post codes. Here we describe how you can segment your records based on the 'postcode area' which is defined by the first alpha characters in a post code.

Anatomy of a UK post code
Courtesy of GetTheData.com

In this article we are going to be segmenting records based on the Postcode Area (blue). For example, for the postcode B2 6DG, the postcode area is B. See this reference for a full list of Postcode Areas with drill downs.

Note: It isn't possible to simply set your criteria like this: PostalCode CONTAINS B because this would also match postcodes like CB (Cambridge). So we need to do an exact match on the Postcode Area portion of the postcode (the bit in blue).

1. Create a field that will contain the Postcode Area extracted from the post code
This is simply a case of creating a formula field on your object that extracts only the Postcode Area portion from the UK post code. So if your post code is HP13 5EE, it would extract just HP.

Steps:

  • Create a formula field of type TEXT named UK Postcode Area
  • For the formula, use this: 

LEFT(PostalCode, 1)+IF(ISNUMBER(MID(PostalCode,2,1)), '', MID(PostalCode,2,1))

Save and accept the defaults. You don't need to show this on your page layout.

2. Enable this new UK Postal Code field for SuperRoundRobin
Go to the Utility Tools tab in SuperRoundRobin
In the Field Wizard, ensure that your object is selected in the drop down
Find the UK_Postcode_Area__c field and click the Enable button, moving it over to the list on the right

3. Configure your MatchRules and MatchGroups
This is simple - just create a MatchRule with a pipe delimited list of Postcode Area codes that defines the territory. For example here is one defining a territory in the South East:

Notice you are using the UK_Postcode_Area__c formula field you created in Step 1 and enabled in Step 2.

Create as many MatchGroups as you have territories, each with their own specific MatchRule with their set of Postcode Areas.