What purpose do geographic polygons serve in Salesforce Field Service territory management?
Answer
Basics: A territory has an address, but real service areas are irregular: a postcode set, a river boundary, a city district. Polygons capture that shape.
How it works: In the Field Service Admin app, you draw polygons on the map (or import them, for example from KML) and link them to a Service Territory. Polygons display on the dispatcher console map. An appointment's or work order's geocoded latitude and longitude can be tested against the polygons to find the right territory. The managed package exposes Apex utilities (for example FSL.PolygonUtils.getTerritoriesByPolygons; verify the current signature) that you can call from Apex or Flow-invoked code to assign the territory.
Advanced / deep dive: The polygon feature does not auto-assign territories on its own; you must call it from a trigger, Flow or batch when a work order or appointment is created. Overlapping polygons can return multiple territories, so define a tie-break rule. Large, detailed polygons can impact map performance. Polygon accuracy depends on the geocoding accuracy of the address, so bad geocodes assign the wrong territory. Alternatives: territory assignment by postcode lookup table, which is simpler but less accurate for irregular areas. Polygons are used in conjunction with scheduling for validating that resources work within boundaries.
Hidden gotchas & must-remember points:
- Without geocoded coordinates, a point cannot be matched to a polygon.
- Overlapping polygons need explicit handling.
- Territory assignment by polygon is not automatic; it requires configuration or code.
- Polygons live in the FSL managed package and need the right permissions.
- Large polygon sets slow the map.
Best practice: Keep polygons simple, avoid overlaps and automate territory assignment in a bulk-safe Flow or Apex step at creation.