Monday, 14 March 2016

Salesforce and Google Drive Integration


Upload your Salesforce data into Google Drive in a Single Click

Benefits :  Get your data in sync between Google drive and Salesforce. It supports all file types including Google Docs, and all objects including Standard and custom objects. We can fetch object records/Wrapper data in google documents.

How it works :
   This task has been categorized into two part
   1. Authentication of Google Drive(Step 1 to 7)
   2. Create a file and upload on Google Drive (Step 8 to 10)

#Google Drive Authentication
  1. Create an Google Account
  2.  Login to Google Account(Hope you are already logged in), Go to Google Developer Console
  3.  From the project drop-down, select an existing project  , or create a new one by selecting Create a new project.





4.  In the left side menu click on API Manager, now click on Drive API under Google Apps APIs, Enable Drive API.                    
5.  In the sidebar under "API Manager", select Credentials, then select the OAuth consent screen tab.
     * Choose an Email Address, specify a Product Name, and press Save.
6.  In the Credentials tab, select the New credentials drop-down list, and choose OAuth client ID - >Web Application
Fill this Information 
a. Name - Salesforce(You can change)
b. Authorized redirect URIs - https://drive.google.com/drive/my-drive (You can change).




 7. Now we have client Id and Client secret, This keys will be used in Salesforce apex code


# Creating File and upload on Google Drive

8.  Create an apex class in salesforce having Name - GoogleDriveIntegrationController
     you have to put your own key and secret key in this apex class

9. Create an apex Page in Salesforce -  GoogleDriveIntegration

10. Load page from salesforce, Click on download button, You will be redirect on Google Drive , there will be a file you just created now.

Salesforce and Google Drive : Better Together

ENJOY :-)