Newer Version Available

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

Retrieve Data That Salesforce Maps Hosts

The GetHostedData() Apex method retrieves geographical IDs for properties and displays them in Salesforce Maps. We accomplish this retrieval in two requests while using the same method. The first request returns geographical IDs for properties that Salesforce Maps hosts for a specified area and filter criteria. The second request takes these geographical IDs and display parameters, such as legend and popup information, and displays them in Salesforce Maps.

Signature

Where,
  • maps is the namespace that's available after you install Salesforce Maps.
  • API is the class that contains the global methods exposed to developers.
  • GetHostedData() is the method.

Sample Code to Retrieve Geographical IDs

The first example request using the GetHostedData() method returns geographical IDs for women-owned businesses that Salesforce Maps hosts. Those businesses produce revenue between $100,000 and $1,000,000 in a specified area.

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

Warning

Input Format of the Parameters

Example

Sample Response of Geographical IDs

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

Sample Code to Display Geographical IDs

The second request using the GetHostedData() method takes the geographical IDs and display parameters, such as legend and popup information, and displays them in Salesforce Maps.

Input Format of the Parameters

Example

Sample Response of Displaying the Geographical IDs

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