Boost recurring donations this giving season with the new upsell prompt!Learn How >>

Allowing visitors to search for Salesforce records within a geographic radius

updated

In Directories, you can allow visitors to search for locations within a given radius of an address they provide. To do so, you must display the search form to the visitor so they can provide their address and the object referenced by the Search form must have valid address data.

Searching on Account, Contact or Lead objects

For Directories searching and displaying records from the Account, Contact, or Lead objects, Soapbox integrates with an optional Salesforce geocoding service that automatically geocodes any valid addresses for these records. In order to use this service, you must first enable it in Salesforce.

Once enabled in Salesforce, you can setup the zip radius search for a Directory in Soapbox by doing the following:

  • Open the Directory containing the records with the address fields you wish to search
  • Click the Search Form tab
  • Click Add Salesforce Element
  • In the Salesforce Field drop down, select the zip code field of the address you wish to use in the radius search
  • Click Save
  • Click the Options tab
  • In the right column, click Parameters - Search Form to open the pane

    screenshot-predefined-radius-search.png

  • For Radius Field, enter the Salesforce API name for the zip code field you added on the Search Form (e.g., MailingPostalCode). You can find the Salesforce API name for the zip code field on the Search Form tab in the Element column for the field you added above. You won't need to include the object name when adding it here.
  • For Radius Distance Display, select Predefined Values if you wish the visitor to choose from a set of options you define or Input Text Box if you wish them to type in their own radius value
  • If you selected Predefined Values for the Radius Distance Display, for Radius Distance Values, enter a series of comma-separated values that will populate the options in the drop down for the visitor
  • For Radius Distance Default, enter a value you wish to populate the distance field by default
  • For Radius Distance Units, choose whether miles or kilometers should be select as the default unit of measurement
  • For Salesforce Geocode Field, enter the Salesforce API name for the address on which you wish to search (e.g., MailingAddress, BillingAddress, OtheAddress)
  • Click Save

Searching on Other Objects

For Directories searching and displaying records from objects other than Accounts, Contacts, or Leads objects, Soapbox requires that the object have both a geolocation custom field as well as a field containing the zip code for the location. You will need to add each to the object before setting up the zip radius search in Soapbox. Once added, you'll need to populate each for the records you wish to return as part of the search with both the latitude and longitude in the geolocation field and zip code in the zip code field.

Once created in Salesforce, you can setup the zip radius search for a Directory in Soapbox by doing the following:

  • Open the Directory containing the records with the address fields you wish to search
  • Click the Search Form tab
  • Click Add Salesforce Element
  • In the Salesforce Field drop down, select the zip code field you wish to use in the radius search
  • Click Save
  • Click the Options tab
  • In the right column, click Parameters - Search Form to open the pane
  • For Radius Field, enter the Salesforce API name for the zip code field you added on the Search Form (e.g., MyPostalCode__c). You can find the Salesforce API name for the zip code field on the Search Form tab in the Element column for the field you added above. You won't need to include the object name when adding it here.
  • For Radius Distance Display, select Predefined Values if you wish the visitor to choose from a set of options you define or Input Text Box if you wish them to type in their own radius value
  • If you selected Predefined Values for the Radius Distance Display, for Radius Distance Values, enter a series of comma-separated values that will populate the options in the drop down for the visitor
  • For Radius Distance Default, enter a value you wish to populate the distance field by default
  • For Radius Distance Units, choose whether miles or kilometers should be select as the default unit of measurement
  • For Salesforce Geocode Field, enter the Salesforce API name for the geolocation field you created in Salesforce (e.g., MyAddress__c)
  • Click Save

Legacy Marker-Based Searches

A legacy version of the zip radius search geocoded records from Salesforce and stored the markers locally. For Directories that existed prior to August 2019 and had already created markers, you can manage that legacy functionality as follows:

  • Open the Directory containing the records with the address fields you wish to search
  • Click the Options tab
  • In the right column, view Parameters - Search Form

    map-records-param.png
  • For Radius Field, enter the field name containing the zip code you wish to use for the radius search. For example, if you were searching on the Contact object and wished to use the Mailing Zip Code, enter "MailingPostalCode" - without the quotes.
  • For Address Fields, enter a pipe delimited list of the address fields for this record. For example, if you were searching on the Contact object and wished to use the mailing address, enter "MailingStreet|MailingCity|MailingState|MailingPostalCode" - without the quotes.
  • For Build Markers, choose Update
  • In the right column, click Parameters - Record Display
  • For Map Record, select if you would like a map inset to appear on the Record Display view
  • Go to the Search Form tab
  • Add the same Salesforce field you identified in the Radius Field by clicking Add Salesforce Element, as you would any other Salesforce Element. This will add the zip code field as a search field on the form with a drop down allowing the visitor to select the size of the radius search in miles or kilometers.
  • Click Save
Have more questions? Submit a request
Article is closed for comments.