Google to Salesforce integration step by step

By

5 minutes de lecture
Employée travaillant sur un ordinateur portable et trouvant une idée au problème

At Texeï, we have recently been through Lightning Sync for Gmail to activate this Spring’ 17 fresh new feature for one of our client… and it wasn’t as easy as it seems…

Despite an official documentation was released by Salesforce to help us handle the technical part of the configuration, it can still remains complicated for those of us who aren’t familiar with Google admin consoles and APIs.

We hope that the following step by step tutorial will enable Salesforce Admins to save time configuring this new awesome feature.

Before we start, you’ll need to open 3 different tabs in your favorite browser :

  1. Once logged in into your Salesforce org, navigate to Setup / Email / Lightning Sync / Sync Setup
  2. As your company use Google for work to manage emails, go to https://console.cloud.google.com/ also known as Google Cloud Platform and be sure to login with your admin credentials (the ones you use to manage your company email service)
  3. You’ll also need to configure (as an admin) your google for work console which can be found at this URL: https://admin.google.com/your_google_domain/

Now that you’re ready let’s go through the technical stuff :

1. From the Salesforce setup page

Make sure to enable Lightning Sync and choose your connection method: OAuth 2.0 for Google.

Lightning Sync Setup
You should also make sure Enhance Email feature is enabled for your org.

2. From your google cloud platform console

Navigate to API Manager with the hamburger menu

Google Cloud Platform

 

Create a new project within your google domain

It can be easily done from the menu top bar.

Create a new project within your google domain

 

Creation of a new project takes a couple of seconds in order to be provisioned

Creation of a new project Salesforce sync
Be sure to choose a meaningful name. It generally takes 10 to 30 seconds to provision the newly created project.

Now that you’re in your new project, under the top bar menu, click Enable API and search for Calendar in the search box.

Choose Google Calendar API and click enable

https://giphy.com/gifs/3o7btOHeTCtWd7b3uU/html5

Back to the project, repeat the same operation to enable the Contact API.

Once these two API activated, we need to create credentials from the project main page. Navigate to credentials from the left menu.

Click Create Credentials and choose Service Account Key from the top-down menu

API Manager : Create Credentials and choose Service Account Key

 

The next screen allows you to choose several options when creating a new Service Account key :

(1)Choose New service account

(2) Name your account

(3) Select Project Owner role from the cascade drop list

(4) Choose to generate a JSON key type

(5) Generate the JSON key ans make sure to save it locally on your computer

API Manager : choose several options when creating a new Service Account key
The private key newly generated enable access to your company calendars and contacts. Be sure to keep it safe

When done, you now need to complete a few more steps to grant your project access to G suite for your whole company.

From the credentials screen, you can know access the newly created service account key.

Click on the Manage service account : link on the right top corner of the service accounts list.

It leads to your project IAM & Admin console where you need to Edit your Service Account properties

IAM & Admin : edit your Service Account properties

Click Edit from the “3 dots” button linked to your Service account to edit properties

Edit service account
Tick the box to enable G suite DwD and Configure consent Screen

On the consent screen, make sure to select your current company email address and fill in the Product name shown to users field with a meaningful name. You can leave the others fields blank as they are optional. When you’re done, save your Service Account Edit page.

Congratulation, your Service Account is now created ! Be sure to copy your Client ID as we’ll need it later.

Service Account is now created

3. From Google for work console

Navigate to Security / Advanced settings / Manage API Access

 

Be sure to login as admin as you need permission set to access API Management to integrate G suite with third party softwares

When you’re in, from the Manage API client access, you can add an entry to authorize your client.

(1) In Client Name enter the Service Account Client ID you previously copied at the end of step 2

(2) In API Scopes, enter these URLs, separated by a coma:

https://www.google.com/m8/feeds
https://www.googleapis.com/auth/calendar.readonly
https://www.googleapis.com/auth/contacts.readonly

(3) Authorize your Client to access these APIs

 

For official Salesforce’s information about these APIs, please see this help page, section 2 / c.

4. Back to Salesforce Setup to (finally) configure Lightning Sync for Gmail

First, make sure you properly enabled Lightning Sync feature and chose the right authentification method -> OAuth 2.0 for Google

Next, you’ll have to import the JSON key file you generated in step 2.

Lightning Sync Setup

 

Before testing your connection, you’ll need to wait for a couple of minutes (2 to 5 generally)

In addition, you’ll need to configure a new user (or group) in order to test your Google to Salesforce connection. Make sure to activate your configuration when done.

This basic configuration is easily done through the Sync Configuration menu. It provides a step by step menu to provision a new user and choose the data set you want to synchronise.

Setup Sync Configurations

5. Test your connection

This can be done either in Sync Setup or Sync Status. Just enter the user’s email adress you want to test. If successful (and it should be the case), you’ll be notified.

Do not forget to wait a couple of minute before testing, time for the APIs to run … :-)

Finally, enjoy your google calendar right into Salesforce !

For the contacts synchronisation, note that a new Salesforce Sync group has been added to your Google contact account.

Any questions or suggestions ? Fell free to leave a comment !

Read more posts

Enforce code standards with PMD

Developers working on a project usually set coding rules to have a standardized codebase. It is an important piece of the code maintainability, and it can be very easy …
March 2023
Advices
Scratch orgs

Uncovering Salesforce Settings: A Step-by-Step Guide for Scratch Orgs

Today, it’s pretty easy to build your Scratch Org definition file when you know what Settings you want to activate, as they are mapped with the same setting names …
February 2023
Advices
Business Analyst

Core qualities of a Business Analyst?

A common definition we are used to hear is that being a Business Analyst means to have a combination of both hard skills and soft skills. What does a …
June 2022
Advices
Image d'illustration d'une employée travaillant sur un ordinateur portable

Process builder and workflow make way to Flows (½)

Overview “If you can do it with a Workflow, then do it with a Process Builder, because everything a Workflow does, a Process Builder does it better”. If you …
March 2022
Advices

Day 22 : Salesforce new “Migrate To Flow tool” in Spring 22

As most of you already know, the workflow rules and process builders are planned to be retired in 2023 (no precise date defined so far). Today, I’m going to …
December 2021
Advices

Day 18 : Fake callout responses for test classes !

Hello everybody ! Today let’s talk about Apex tests classes in Salesforce. Everyone loves a good test class, and Salesforce makes it official by requiring to have a minimum …
December 2021
Advices