Shape fields allow you to associate a geographic area with a record. These shapes can be complex polygons, circles or even lines. Examples of these shapes could be property boundaries, business franchise areas, delivery areas for a restaurant or water lines.
Note: It is important to understand this Shape Field functionality is best used to describe an attribute of a record in your system. It is tempting to use these for some form of territory coverage but that is not how they are designed to be used. They are meant to describe a geographic area specific to a record. Imagine if when creating a new field in salesforce.com for a custom or standard object there was a new field type called Shape. If you are looking to assign records to records to territories/regions, you will want to look into our Assignment Plan feature.
This document will explain how to setup and use Shape Fields while also walking through a typical use case. In this example we will build a Shape Field that represents the delivery area for for a food restaurant.
Step 1: Create a Shape Field
The first step to mapping a restaurant’s delivery area is to create a shape field. In our organization we have a custom object called Restaurant. On this object we need to create a new custom field lookup to the Geopointe Shape object.
Select the Lookup (Relationship) field type.
Relate this lookup field to the Geopointe Shape object.
Change the name of the field to reflect the shape area. In this example we will call it Delivery Area. It is highly recommend to check the box that says, “Don’t allow deletion of the lookup record that’s part of a lookup relationship.” This will prevent the shape from being deleted if it is in use by any records.
We also need to create a Lookup Filter for this field where Geopointe Shape: Usage Type = ‘Shape Field.’
After these steps have been completed continue through the new custom field wizard to set user access and add the field to page layouts as necessary.
Step 2: Enable the Add Shape Action
Once this Delivery Area Shape Field has been created we need some way to populate and build the shapes. Geopointe includes a record action called “Add Shape” that allows us to do this. (Learn more about Actions here). First we need to enable this “Add Shape” action.
Navigate to the Geopointe Setup tab and within this page select the Actions tab.
In the list of Record Actions look for the “Add Shape” action and Edit the record. Upon editing, set the Available (Web) field to true and save it.
Step 3: Add a Shape to a Record
Now we can start to create Shapes and related them to records in our system. In this example I will view a Restaurant record and then select the Map button at the top of the record.
This will load the map and drop a marker on the map for this record. Select the marker on the map to view the info window for this record and then select the Add Shape action.
This will put the map in to Add Shape mode and we can start to draw a delivery area on the map. Note the Field picklist currently says Delivery Area but if you have multiple Shape Fields on a record you can choose which field should be populated with the new shape.
We can also change the shape to a circle and define a range.
Finally, you can also use our shape library to define the shape. They will add to the map as you select them in the list. Once satisfied with the shape we can select the Save Shape button.
Selecting the Map button again from a restaurant we will see the marker representing the location of the Restaurant and the Delivery Area shape for that restaurant.
Thats it! We’ve now created and populated a Shape Field on a custom object in our system.
To edit saved shapes simply click the shape on the map and then select the Edit option from the Actions drop down list.
Shape Field Searching
Loading the map from a single record will show that record’s related shapes but the next logical step would be to search for multiple restaurants and see all of their delivery areas on the map at once. This is easy to do as well. Sticking with our restaurant example let’s say we have a Contact record and we want to see if this contact lives within the delivery area for any of the restaurants in our system.
We will navigate to Contact record and select the Map button.
In the Data Set drop down list we will select the Restaurants Data Set.
If we did a search right now we would only see markers indicating the locations of the restaurants. To also display the delivery area we need to make sure the Delivery Area field is included in the list of selected fields for this Data Set.
Select the gear icon next to the Data Set name.
Then navigate to the Fields section and select the Add Field link.
Add the Shape Fields you want to show on the map. In our example this is the Delivery Area field. Make sure you select the field with (Shape) in parentheses.
Now let’s perform a search to find all Restaurants within 0.5 miles of this Contact. On the map you can now see the location of the restaurants as indicated by the pin markers and the related Delivery Area.
We can see the contact (red pin, yellow house) is within the blue shape. Clicking on shape let
s us know this contact is within the Delivery Area for the Thai Tastic restaurant.
IMPORTANT NOTE: When you include a Shape Field in the list of fields for a search the map searches are still looking at the point data for a record and then including the Shape Field area. These searches do not look at the bounds or outline of the shape for searching.
Shape Fields in Salesforce1
You can now view shape fields in Geopointe for Salesforce1. The shape field must be created in the browser version of Geopointe in order to be visible in Salesforce1. Simply load the shape field data set to the map to see the shapes. You can then load another data set and tap a shape field to see a summary of records within it, as shown in the screencap below.