Setting up PSA to Filter Resources by Distance

Resource managers can exclude resources who live beyond a certain distance by filtering them based on their proximity to the work location. This is useful when on-site work is involved, and it is preferred to use resources closer to the work location.

Before you filter resources by distance, ensure that:

  • You have set up the Google API keys. For more information, see Setting Up Google API Keys.
  • You have Google Maps activated to enable the geocoding services in your org. For more information, see Activating Google Maps.
  • You have activated the Googlemaps_api remote site setting. For more information, see Remote Site Settings.
  • You have activated the Geocodes for Contact Mailing Address. For more information, see Activating Geocodes for Contact Mailing Address.
  • You have granted users permission to use the Maximum Distance and Distance Unit fields. For more information, see Assigning Permission Sets.
  • You have selected the Show Distance Filter checkbox in the Lightning App Builder properties. For more information, see Using the Resource Filter in the PSA Resourcing Lightning Component.
  • You have added the Maximum Distance and Distance Unit fields on the Resource Request object to relevant page layouts and profiles. You would also need the Work Address fields on the resource requests page and the Mailing Address fields on the Contact page. For more information, see the Salesforce Help.

Setting Up Google API Keys

Before trying to set up Google API keys in your org, ensure that you have a Google account and a geocoding API key. This key is used to translate address information into latitude and longitude coordinates. You can obtain this from the Google Maps Platform.

Notes:

Ensure that the following custom settings are deselected in the Trigger custom setting:

  • Resource Geolocation Trigger Disabled
  • Res Request Geolocation Trigger Disabled

If you select these custom settings, then the resource’s geographic location data is not populated from Google. For more information on these custom settings, see Trigger Settings.

To obtain the Google API key:

  1. Browse to the Google Cloud Platform https://console.cloud.google.com/.
  2. Log in to the Google Cloud Platform using your email and password. If you are a first-time user, select the Terms of Service checkbox and click AGREE AND CONTINUE.
  3. Contact your IT team to set up a new Google project. To create a new project, navigate to the navigation menu and click Select a project | Create a Project.
    1. Specify the following details:
      1. In the Project Name field, enter the project name.
      2. In the Organization drop-down list, select the organization name to attach the project.
      3. In the Location field, browse and select the parent organization or folder.
    2. Click CREATE. You receive a notification and the dashboard displays.
    3. In the Select a Project drop-down list, select the new project. For more information on creating and managing projects, see Google Cloud Documentation.
  4. If you are an existing user and have an existing project:

    1. Navigate to https://console.cloud.google.com/apis/library.
    2. Select a project drop-down list at the top left side, next to the navigation pane. Contact your IT team to grant you access to this project to enable APIs.
    3. Locate and search for the geocoding API and click Geocoding API.
    4. Click Enable.
      1. For account information, select your country and click AGREE & CONTINUE.
      2. Choose standard or discount and continue to fill in payment details.
      3. After filling in your payment details, click Continue.
  5. Navigate to the navigation menu, on the APIs & Services tab, click Credentials.
  6. On the navigation header bar, click Create Credentials and then click API Key.
  7. Copy your newly created API key and it is ready to use.
Notes:
  • To help keep your Google API keys secure, follow the best practices for adding API restrictions on the Google Cloud Documentation. For example, https://cloud.google.com/docs/authentication/api-keys#adding-api-restrictions.
  • Google Geocoding API services are chargeable. For more information about Geocoding API Usage and Billing, see the Google Maps Platform Documentation.

To set up the Google API key in your org:

  1. Navigate to Setup, click Custom Code | Custom Metadata Types.
  2. Click Manage Records next to the External API Credential custom metadata label.
  3. Click New to create a new record. The External API Credential Edit page displays.
  4. In the API Key field, enter your Google API key.
  5. Enter a record name without spaces in the Label field. This record name must be listed alphabetically first in your record names list. For example, A_test_api.
  6. The External API Credential Name field is auto-populated with the record name in the Label field. If you want the External API Credential Name to differ from the Label, then edit it.
  7. Enter https://maps.googleapis.com in the API URL field.
  8. Click Save.
Notes:
  • If you do not see the API Key field, edit the page layout by dragging and dropping these fields. For information about editing page layouts, see Salesforce Help.
  • You must ensure that your Google keys are set up correctly to utilize Google Maps. Google restricts support for digital signing of requests to the Geocoding API. To increase security and avoid being billed for unauthorized use, it is recommended that all Google Maps Platform API services follow API security best practices.
  • For more information about the Google Maps Platform security guidance and how to create, restrict, and use your API key for the Google Maps Platform, see the Google Maps Platform Documentation.

Activating Google Maps

The resource request and contact records of resources must also have latitude and longitude values. These values are updated only when you enable the geocoding services in your org. The geocoding services provide latitude and longitude coordinates from the work address fields on the resource request and the contact records using the Google Maps service.

To turn on Geocoding Services:

  1. On the PSA Administration page, click Geocoding Services | Manage Geocoding Services. Manage Geocoding Services window displays.
  2. Click Activate Google Maps.

For more information, see PSA Administration.

For accurate latitude and longitude values, ensure that the user provides a complete address and fills in the complete address fields to auto-populate these values on the resource request page. The latitude and longitude values are auto-populated using data from the following fields on the resource request record:

  • Work City (PSA)
  • Work Country (PSA)
  • Work Street (PSA)
  • Work Zip/Postal Code (PSA)
  • Work State/Province (PSA)

For accurate latitude and longitude values on the contact page, ensure that the user provides a complete mailing address and fills in all the Mailing Address fields to auto-populate these values on the contact page. The latitude and longitude values are auto-populated using data from the following fields on the resource contact record:

  • Mailing Street
  • Mailing City
  • Mailing State/Province
  • Mailing Zip/Postal Code
  • Mailing Country
Note: If you do not already have the Work Address fields on the Resource Request page and Mailing Address fields on the Contact page, then add these to the page layout and ensure that they are populated.

Remote Site Settings

The latitude and longitude values must also be updated on the Contact record page. For this, you must ensure that the Googlemaps_api remote site setting is activated.

To do this:

  1. Click Setup | Remote Site Settings.
  2. Locate and click the Googlemaps_api remote site setting. The Remote Site Details page displays.
  3. Ensure that the correct URL is specified in the Remote Site URL field. For example, https://maps.googleapis.com.
  4. Ensure that the Active checkbox is selected. If not, click Edit to select the Active checkbox.

If the Googlemaps_api remote site setting has not been created, you can create it manually.

For more information about configuring remote site settings, see the Salesforce Help.

Activating Geocodes for Contact Mailing Address

Activating Geocodes updates the latitude and longitude coordinates from the mailing address on a resource's contact record, ensuring accurate location data.

To activate Geocodes:

  1. Navigate Setup, click Data | Data Integration Rules.
  2. On the Data Integration Rules page, click Geocodes for Contact Mailing Address. The rule details are displayed.
  3. Click Activate. The Activate Data Integration Rule window is displayed.
  4. Click OK.

Assigning Permission Sets

Ensure that you have granted the following permission sets to view the Maximum Distance and Distance Unit fields on the Resource filter panel and the Resource Request page:

  • PSA - Manage Resource Requests for an Opportunity
  • PSA - Manage Resource Requests for Project