xMatix
Sign in Request demo
xMatix
PRODUCTS
SalesField Sales & SFACRMRewardsClaimsInventoryProcurementWarehouse ManagementField ServiceServiceSupportTelephony & MessagingFinance & AccountingPayrollExpense ManagementCommercePortalsAnalytics & ReportingData StudioMobile AppSee all products →
PLATFORM
Platform overviewApp BuilderAutomationIntegrationsSecurity & GovernanceChange ManagementDevelopers
SENSE AI
Sense AI overviewSense AssistSense ControlSense VisionAI StudioTrust & governanceIn Claude & ChatGPTUse cases
SOLUTIONS
Auto DMSConsumer Goods DMSSales Force Automation (SFA) FMCG & DistributionManufacturing & Dealer NetworksAutomotive & DealershipsPharma & HealthcareConsumer DurablesAgri-InputsBuilding MaterialsService NetworksWarehousing & 3PLFinancial AccountingERP SoftwareIndia GST ComplianceUAE VAT & e-InvoicingSaudi ZATCA & VATAll solutions →
RESOURCES
Knowledge CenterDeveloper & CLIBlogGuidesWhat is xMatix?Company facts
COMPANY
AboutCareersPartnersEventsContactAuthorsLegal
Sign in Request demo
Home/Docs/Field Sales/Optimize a route
HOW-TO · Last reviewed

Optimize a route

VIDEO
Route optimization: from beat to optimized sequence
A 5-minute walkthrough of this page is coming soon — the written steps below cover the same ground.

Route optimization reorders a beat's stops over real road distances, so the executive can drive the shortest practical loop instead of the order the stops were typed in. It is an on-demand action: each run sends one paid request to a routing service, so you run it when a beat's stops change, not on a timer. The result is stored on the visit route as a new stop order, which plans generated afterwards carry alongside the authored order.

Overview

A beat has up to three stop orders, and the executive's agenda can show any of them:

OrderWhere it comes fromStored as a run?
PlannedThe stops' Sequence Number, as authored on the routeNo — it is read from the stops each time
OptimizedOptimize Route Sequence (road distances) or Recompute Sequences (straight-line nearest-neighbour)Yes
Mostly FollowedThe average position of each stop in the order visits were actually startedYes — one for the route and one per executive with visit history

Each stored run is a Route Sequence record. It records its algorithm, total distance, estimated duration and how many stops it moved compared with the Planned order, and its Entries tab holds one rank per stop. Earlier runs are kept, so you can compare and switch back.

Runs are grouped into families: one route, one Sequence Type and one Salesperson (empty for route-wide runs). Exactly one run per family is meant to be current, and only the current Optimized and Mostly Followed runs are used. Optimized runs are always route-wide; Mostly Followed runs exist once for the route and once for each salesperson with visit history.

When to use it

  • After building a new beat, or adding or removing several outlets.
  • When the field reports that the authored order wastes driving time.
  • To compare the authored order with what executives actually do (Mostly Followed).

How xMatix handles it

  • Optimize Route Sequence sends the route's approved stops that have their own Account Location to the routing service. The order that comes back becomes the route's current Optimized run, with real driving distance and duration. Stops without an Account Location are added at the end in their authored order. If no approved stop has coordinates, nothing is sent and no run is stored.
  • Recompute Sequences costs no request. It stores a new Optimized run computed by straight-line nearest-neighbour, starting from the route's coverage midpoint when one is set, plus fresh Mostly Followed runs from visit history.
  • A new run replaces the current one of the same kind. So Recompute Sequences, and the background refresh when it is switched on, replace a road-optimized run with a straight-line one. Re-activate the road-optimized run afterwards if you want to keep it (Step 3).
  • When a plan is generated, every visit gets three positions: its Planned position from the stop's Sequence Number, and its Optimized and Mostly Followed positions from the route's current runs. For Mostly Followed, a current run for the plan's salesperson wins over the route-wide run. A route with no current run of a kind (or one with no entries) gets that order computed at that moment; the computed Optimized order then starts from the plan's start location rather than the route's coverage midpoint. Stops added after a run was computed are added at the end.
  • The route's Timeline tab shows the route-wide current run of each kind. A salesperson's Mostly Followed run is shown there only when the route has no route-wide one.
  • Existing plans never change. Optimizing or activating a run affects plans generated afterwards only.

Prerequisites

  • A visit route with approved stops.
  • An Account Location on each stop. The account's own location isn't used for optimization. See Route stops.
  • Road-network optimization available in your environment. If it isn't, the action says so (see Common problems). Recompute Sequences works without it.
  • The Optimize Route Sequence or Recompute Sequences permission (see Permissions).

Procedure

Step 1 — Run the optimization

Open the route and check on the Visit Route Stops tab that every outlet has an Account Location. Then select Optimize Route Sequence in the page header. The run starts straight away, so select it once and wait.

To optimize several beats, open the Route Optimization page in the Field Sales app. It lists each route with its Salesperson, Algorithm, Last optimized, Distance, Est. time and Resequenced count from its current Optimized run. Use Optimize route on a row, tick rows and use Optimize selected, or use Optimize all for every listed route. Each asks for confirmation and states how many paid requests it sends, then reports how many routes were optimized and how many failed.

Step 2 — Review the result

On the route, open the Route Sequences tab to see its runs, newest included. Select a run's name to open it. The run page has two tabs:

  • Entries — one row per stop with its Route Stop, Rank and, on Mostly Followed runs, Score (how often the stop was visited per plan).
  • Details — Visit Route, Salesperson, Sequence Type, Algorithm, Is Current, Computed On, Total Distance (km), Est. Duration (min) and Stops Resequenced (see Fields below).

Compare these figures with earlier runs. On the route's Timeline tab, switch between Planned, Optimized and Mostly Followed to see each order on the map.

The run page is read-only: its only button is Activate. Runs aren't edited or deleted from it.

Step 3 — Choose the current run

The newest run of each kind is current automatically. To go back to an earlier run (for example a road-optimized run after Recompute Sequences replaced it), open that run from the Route Sequences tab and select Activate. It becomes the current run of its kind; the others are kept as history.

Step 4 — Refresh Mostly Followed

Select Recompute Sequences on the route and confirm ("Recompute Sequences?"). xMatix stores new Mostly Followed runs from the visits started so far, for the route and per executive, and a new straight-line Optimized run. Re-activate your road-optimized run afterwards if needed (Step 3).

Step 5 — Let new plans pick it up

Nothing else is needed. The next plans generated for the route carry the current Optimized and Mostly Followed orders, and executives switch between Planned, Optimized and Mostly Followed on the plan's agenda. Plans generated before the run keep their earlier orders.

Step 6 — Reorder an existing plan

Route runs don't reorder plans that already exist. The Visit Plan action Apply Sequence To Plan, which stamps a stored run onto a plan's visits as their planned order, is delivered switched off. An administrator can switch it on in the Visit Plan entity's actions (see Entity behavior). Otherwise, the executive simply follows the order they choose on the agenda.

Fields

Route sequence (Details tab)

xMatix fills every field when it creates the run.

FieldWhat it meansNotes
Visit RouteThe beat whose stops this run orders.
SalespersonThe salesperson whose visit history built this Mostly Followed run.Empty on route-wide runs. Optimized runs are always route-wide.
Sequence TypeThe kind of order: Planned, Optimized, Mostly Followed or Custom.xMatix produces only Optimized and Mostly Followed runs. Planned and Custom runs are never created and are not used for plans.
AlgorithmWhat produced the run.NearestNeighbour = straight-line run from Recompute Sequences or the background refresh. History-AllTime = Mostly Followed run. Any other value is the routing service used by Optimize Route Sequence.
Is CurrentThis run is the one new plans use within its family.Changed by new runs and by Activate.
Computed OnWhen the run was computed.The background refresh uses this date to decide whether the route is due again.
Total Distance (km)The length of the order.Driving distance for road-network runs. Straight-line distance for the others, including the leg from the coverage midpoint when the route has one. Stops without an Account Location aren't counted.
Est. Duration (min)Estimated driving time.The routing service's estimate for road-network runs. Otherwise Total Distance at an average of 24 km per hour.
Stops ResequencedHow many positions hold a different stop from the authored order.0 means the run matches the Sequence Number order.

The run's Name is set when it's created, from the route name, the sequence type, "rep" for a salesperson's run, and the date and time in UTC. For example, a run computed at 15:00 IST carries 09:30 in its name.

Route sequence entry (Entries tab)

FieldWhat it meansNotes
Route SequenceThe run this row belongs to.
Route StopThe stop being placed.One row per approved stop at the time the run was computed.
RankThe stop's position in this order, starting at 1.
ScoreMostly Followed runs only: started visits to the stop divided by the number of plans in the history.1 means visited on every plan. Empty for stops never visited, and on Optimized runs.

Business rules

  • Only stops whose status is Approved (or older stops with no status) are optimized.
  • Optimize Route Sequence uses only the stop's own Account Location. Stops without one trail in authored order.
  • Each run of a kind supersedes the previous current run of that kind for the same route (and executive, for Mostly Followed). Superseded runs are kept.
  • Recompute Sequences and the background refresh store a straight-line Optimized run, which replaces a road-optimized one as current.
  • Runs never change plans that already exist.
  • Routing Priority on the route is not used by optimization.
  • Activate clears Is Current on the other runs of the same family (same route, Sequence Type and Salesperson) and sets it on the selected run. No ordering data changes.
  • A current run with no entries counts as no run: plans compute that order themselves.
  • The background refresh treats a route as due when it has no current route-wide Optimized run, or when a stop or a started visit on the route was saved after that run's Computed On. Activating an older run therefore makes the route due again at the next pass if anything changed since that older run.
  • A stop moved to another beat with Outlet Transfer keeps its rows in the old beat's runs, which are ignored because the stop is no longer on that beat. On the new beat it has no rank until the next run, so it trails at the end.

Example

The beat North Market — Tuesday has eight approved stops, typed in the order they were signed up. The planner checks that each has an Account Location and selects Optimize Route Sequence. On Route Sequences a new Optimized run appears: 23.4 km, 58 minutes, 5 stops resequenced. On the Timeline tab, the Optimized loop no longer crosses the ring road twice.

A week later a supervisor selects Recompute Sequences to see how the beat is actually driven. A Mostly Followed run appears, and so does a new straight-line Optimized run, now current. The planner opens the earlier road-optimized run and selects Activate, and the following Tuesday's plan carries the road order again.

Training

Practice exercise

In a sandbox, open a route with at least four approved stops that have Account Locations.

  1. Select Recompute Sequences and confirm.
  2. Open Route Sequences and note the new Optimized run's algorithm and distance.
  3. If optimization is available, select Optimize Route Sequence and compare the new run.
  4. Open the run from step 2 and select Activate.

Expected result: step 1 creates an Optimized run with the nearest-neighbour algorithm (and Mostly Followed runs if the route has visit history). Step 3 creates a newer Optimized run that becomes current. After step 4, the step 2 run is current again and the step 3 run is kept as history.

Quick reference

  • Planned = Sequence Number order; it isn't a stored run.
  • Optimize Route Sequence = paid, road distances, approved stops with an Account Location only.
  • Recompute Sequences = free, straight-line Optimized plus Mostly Followed.
  • The newest run of a kind is current; Activate brings back an earlier one.
  • Recompute replaces a road-optimized run as current, so re-activate it if needed.
  • New plans pick up the current runs; existing plans never change.
  • A run's page is read-only apart from Activate; runs are never built by hand.

Permissions

ActionDelivered on
Optimize Route Sequence (route page and Route Optimization page)Standard User, System Admin
Recompute SequencesSales Manager, Standard User, System Admin
Activate (on a route sequence)Sales Executive, Sales Manager, Standard User, System Admin

Grants are set on each profile's Actions tab in security profiles. A user without the grant doesn't see the button.

Seeing runs needs read access to Route Sequence and Route Sequence Entry. Sales Executive, Sales Manager, Standard User and System Admin are delivered with full access to both.

Configuration

  • Background refresh. Setup → Feature Hub → Sales → Settings, Schedulers group: Refresh stored route orderings in the background (off by default) refreshes the stored runs of routes whose stops or visit history changed since their last Optimized run, at most once a day per route. Route orderings refreshed per pass (default 50) sets how many routes a pass handles. With it off, nothing changes in plan order: plans compute both orders themselves when a route has no stored runs. Because the refresh stores straight-line Optimized runs, leave it off if you rely on road-optimized runs.
  • Coordinates. Optimization quality depends on each stop's Account Location. See Route stops.
  • Coverage midpoint. Territory planning sets each route it creates a coverage midpoint, which optimization uses as its starting point. See Territory planning.

Common problems

"Route optimization is not configured for this environment."

Road-network optimization isn't available for your organization, so no request was sent. Use Recompute Sequences for a straight-line order, and contact xMatix support if you need road-network optimization.

"This route has no approved stops with coordinates, so there is nothing to optimize."

None of the route's approved stops has an Account Location. Proposed and Rejected stops don't count. Add Account Locations on the stops and try again. No request was charged.

Some stops always end up at the end

Those stops have no Account Location of their own, so they are added after the optimized stops in authored order. Fill in the coordinates on each stop.

My road-optimized order disappeared

A Recompute Sequences run, or the background refresh, stored a newer straight-line Optimized run. Open the road-optimized run on Route Sequences and select Activate.

Today's plan didn't change after I optimized

Runs apply to plans generated afterwards. Existing plans keep the orders they were created with.

The road-optimized run I activated is replaced again the next day

The background refresh is on, and a stop or a started visit on the route was saved after the activated run's Computed On, so the route was due and a new straight-line run became current. Switch the refresh off in Sales settings if you rely on road-optimized runs, or run Optimize Route Sequence again so the newest run is the road-optimized one.

"Name is required" when I try to create a route sequence

The New form for route sequences has no Name field and no automatic numbering, so the save is refused. Runs are created by Optimize Route Sequence, Recompute Sequences and the background refresh, not by hand. To change the order executives plan with, change the stops' Sequence Number instead.

Two runs of the same kind both show Is Current

Is Current was ticked by hand on an edit form, which doesn't clear the flag on the other runs. New plans then use one of them unpredictably. Open the run you want and select Activate, which clears the flag on the rest of its family.

The run page has no Edit or Delete button

That is expected. The delivered run page offers only Activate, because runs are kept as history.

Common questions

Does xMatix re-optimize my routes automatically?

Not over road distances. Road-network optimization runs only when someone selects Optimize Route Sequence or uses the Route Optimization page. The optional background refresh recomputes only the free straight-line Optimized run and the Mostly Followed runs. It is off by default.

What is the Mostly Followed order for?

It shows the beat as it is actually driven. If the field consistently departs from the planned order, that usually reflects real knowledge: opening hours, parking, lunch rushes. Mostly Followed makes that visible, for the route as a whole and for each executive, and lets you compare it with the planned and optimized orders.

Which order does the executive see on mobile?

All three. The plan agenda offers Planned, Optimized and Mostly Followed views, and the executive is free to visit outlets in any order.

Can I store my own stop order as a run?

Not from the delivered screens. The run form can't be saved without a name, and the run page has no way to add entries. Sequence Type offers Planned and Custom, but xMatix never creates runs of those kinds and plans never read them. The order you author is the stops' Sequence Number: change it on the Visit Route Stops tab and the Planned order of every new plan follows it. To reorder a plan that already exists, see Step 6.