Skip to content


Matthew Wood edited this page Oct 26, 2017 · 1 revision

The solution uses some of the standard Salesforce objects:

  • Orders
    • To define what we have to deliver and to whom.
  • Contacts
  • Users
    • to represent our drivers.

To calculate the routes we have created a number of custom objects:

  • Vehicle Type
    • The type of a vehicle, defining its attributes including the capacity.
  • Vehicle
    • A single vehicle with a given vehicle type.
  • Delivery Route
    • The route a driver in a vehicle needs to take, including a number of:
    • Delivery waypoints
      • Relating to the location and the sequence each item will be delivered; and the
    • Warehouse
      • the start and end point of the route.

It is assumed that we need to deliver all orders in a single delivery day, using multiple drivers, each of which is designated a warehouse contact.

Delivery routes for drivers are calculated on demand via a button click in a Lightning component. This causes a process to be kicked off on Heroku by a trivial Apex callout.

The Apex call is "trivial" in the sense that it simply tells our Heroku application that work needs to be done - it does not send the details of the work (delivery points and drivers).

The Heroku application then queries the delivery point and driver data and construct the problem to be solved.

The problem is passed to a Java worker which uses the Jsprit toolkit to solve the problem.

The delivery routes are then saved back to Salesforce with a separate set of records being produced for each driver / route.

Task progress is visible in a Lightning page via a progress indicator.

After the routes are saved in Salesforce, each driver is able to view their deliveries on a Google Maps. We have used the Google Maps Embed API to do this.

Clone this wiki locally
You can’t perform that action at this time.