Newer Version Available

This content describes an older version of this product. View Latest

Create a Route

The CreateRoute() Apex method creates a record that includes a list of waypoints that reps access in Salesforce Maps. The record doesn't include a route between waypoints.

Signature

Where,
  • maps__Route__c is a Salesforce Maps route record containing a list of waypoints.
  • maps is the namespace that's available after you install Salesforce Maps.
  • API is the class that contains the global methods exposed to developers.
  • CreateRoute() is the method.

Allocations

This method requires 2–25 waypoints.

Sample Code

This code returns a maps__Route__c record of waypoints of accounts with billing addresses in Atlanta.

If you invoke methods within a flow, process builder, or trigger, do one of the following to avoid uncommitted work errors.

  • Call the methods through a future method
  • Call the methods as queueable

Different processes refresh the token, such as plotting a route or schedule. The refresh process is almost immediate after each qualifying action occurs.

Warning

Input Format of Waypoints

Example

Sample Response

This method returns a maps__Route__c record, which inserts the waypoints that appear in Salesforce Maps. This JSON response illustrates the essential data stored in the route record.