A project where, through the OpenCage API, we can fill in the Location/Address information in the Account object records in Salesforce.
Explore the docs »
View Demo
·
Report Bug
·
Request Feature
Table of Contents
- In this project, I integrate the Salesforce CRM with the 3rd party API OpenCage Geocoding API.
- About OpenCage Geocoding API: this API provides worldwide, reverse (latitude/longitude to text) and forward (text to latitude/longitude) geocoding based on open data via a REST API. For this project I used these two resource, doing a single implement for each one.
- About Salesforce: I created the OpenCageGeocoderService class responsible to call the 3rd party API and the AccountTrigger responsible for call the service class each time that an Account record is created or update.
This is an example of how you may give instructions on setting up your project locally. To get a local copy up and running follow these simple example steps.
For this project, you need a Salesforce Developer Edition.
- Get a free API Key at OpenCage API - Quick Start
- Clone the repo in your VS Code or IntelliJ
git clone https://github.com/brunagirao/opencagegeocoder-account-trigger.git
- Deploy all the code and configs in your Salesforce Developer Edition.
- On Salesforce, go to Setup > Custom Settings > Select Open Cage Geocoder Settings
- On Open Cage Geocoder Settings > Click Manage > Click in New > Create the **Open Cage Geocoder Settings record **below
- After create Open Cage Geocoder Settings record. You will have this:
- After that, go to AccountTriggerHandler and uncomment one of the methods below to test the functionalities.
-
AccountHelper.fillLocationCoordinatesFields: this method uses the reverse resource of the OpenCage API and it's responsible to fill the Account Shipping Address based on Account Coordinate fields.
-
AccountHelper.fillShippingAddressFields: this method uses the forward of the OpenCage API and it's method responsible to fill the Account Coordinates fields based on Account Shipping Address.
-
- Trailhead - Bruna's Trailhead
- LinkedIn - Bruna's LinkedIn
- Project Link: - OpenCage Geocoder API | Salesforce Account Object