Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

Get the Boundary Information

The GetBoundaryInformation() Apex method returns geographical IDs of locations that fit the specified search criteria.

Salesforce Maps works with data providers that supply property data. Periodically, these providers update their data, which can affect custom code. If the providers change their data formats, update your custom code accordingly. Salesforce Maps can update, replace, or remove property data at any time.

Signature

1Map<String, Object> maps.API.GetBoundaryInformation(String parameters)
Where,
  • maps is the namespace of the Salesforce Maps package. It’s automatically available when the package is installed.
  • API is the class that contains the global methods exposed to developers.
  • GetBoundaryInformation() is the method.

Sample Code

This code finds the geographical IDs of states in the USA beginning with “A”.

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

  • 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

Example

1// Create the search criteria in JSON format.
2String parameters = '{"overlay":"USA","level":"1","filters":[{"field_id":"label","operator":"starts with","values":["A"]}]}';
3
4// Call the GetBoundaryInformation() method with the search criteria.
5Map<String, Object> response= maps.API.GetBoundaryInformation(parameters);
6
7// Log the resulting Geo IDs.
8system.debug(response);

Sample Response

Although the return value is an Apex Map<String, Object> object, this JSON response illustrates the essential data you receive in the resulting map.

1{
2  "endPoint": "https://internal.na.sfmapsapi.com/boundary/search/1",
3  "limitInfo": {
4    "QueryRows": "12 / 50000",
5    "Queries": "8 / 100",
6    "HeapSize": "71096 / 6000000",
7    "CPUTime": "133 / 10000"
8  },
9  "request": "{\"overlay\":\"USA\",\"level\":\"1\",\"filters\":[{\"field_id\":\"label\",\"operator\":\"starts with\",\"values\":[\"A\"]}]}",
10  "params": {
11    "filters": [
12      {
13        "values": [
14          "A"
15        ],
16        "operator": "starts with",
17        "field_id": "label"
18      }
19    ],
20    "level": "1",
21    "overlay": "USA"
22  },
23  "success": true,
24  "data": {
25    "geoids": [
26      {
27        "label": "Alabama",
28        "value": "USA-01"
29      },
30      {
31        "label": "Alaska",
32        "value": "USA-02"
33      },
34      {
35        "label": "Arizona",
36        "value": "USA-04"
37      },
38      {
39        "label": "Arkansas",
40        "value": "USA-05"
41      }
42    ]
43  }
44}