Google Integration with Salesforce | How to connect Google Cloud Platform to Salesforce Cloud

by - 4:53 PM

What is Google Cloud Platform ? 

Google Cloud Platform offers wide range of API, tools and cloud hosted database systems that can be used to make application on top of their platform using 'No Software' just like Salesforce.

What is the Idea? 
The idea behind is to bring to data from Salesforce and dump it into the Google Docs Spresheet, meaning query salesforce using SOQL and bring back data to the spreadsheet.

How can I do that ?  

Google Script API offer bunch of method to connect third party systems, so salesforce would be awesome platform to connect to. I developed a piece of code, provided inspiration from Sanjay Gidwani from ModelMetrics, now Salesforce, which explain more about bridging the gap, thank to him for the basic script that helped me get started early.

CopyRight +Google Developers 

What does Google Offers ?

Google Cloud services offers bunch of outstanding tools and services that helps in developing the application on top of Google's infrastructure, using their API and cloud hosted tools, any developer can create files, applications, store data on their platform integrate other cloud services as well.

While going to wide ranges of API , my attention was stuck on of the great API they offer called 'Google Script API', the Google script is behaves like JavaScript and uses bunch of methods to perform operation on top of Google Apps.

How can I reach to awesomeness ? 

Here is quick glimpse on how you can develop simple script to send email, check it out first

Now check out this video, that shows a glimpse on how can you send a quick email to your Gmail Account. Another reason why I love GoogleDeveloper Channel is the simple videos they host for hungry developers

 

Now having said all, let come back on how to connect to Salesforce, here is the piece of code that explains how can you send a request to external API and render data on grid. I recommend to read more about handling UI of grid (Google Docs Spreadsheet) to know nuts and bells of UI.

Before jumping to Salesforce, I also recommend to read Twitter Approval Manager application design case, which explains how to authenticate user on twitter through app and then pull the data from twitter.

Check out - Twitter Approval Manager Use Case

A quick snapshot is here for calling external API for OAuth

var consumerKey = "... register your app with Twitter ...";
var consumerSecret = "... register your app with Twitter ...";
var oauthConfig = UrlFetchApp.addOAuthService("twitter");
oauthConfig.setAccessTokenUrl(
    "http://api.twitter.com/oauth/access_token");
oauthConfig.setRequestTokenUrl(
    "http://api.twitter.com/oauth/request_token");
oauthConfig.setAuthorizationUrl(
    "http://api.twitter.com/oauth/authorize");
oauthConfig.setConsumerKey(consumerKey);
oauthConfig.setConsumerSecret(consumerSecret);
// "twitter" value must match the argument to "addOAuthService" above.
var options = {
    "oAuthServiceName" : "twitter",
    "oAuthUseToken" : "always"
};
var url = "http://api.twitter.com/1/statuses/user_timeline.json";
var response = UrlFetchApp.fetch(url, options);
var tweets = JSON.parse(response.getContentText());
// Handle tweets
How to connect to Salesforce : Below are the pictures of running on top of Google Cloud Platform, the code the application can be downloaded from Git hub repository added at the end

Clearly you have to make a rest call, authenticate user and read the data response by dumping data into Salesforce Grid (Google Spreadsheet). These are the snap shot of running code that have a very small UI (few dialogue box) and the screenshot below is my code editor for Google



To connect to your Salesforce Instance, you have to go to CloudConnector on the row on top of screen and open up settings, a dialogue box is provided to add username, password and security token as shown in picture


Querying Salesforce 

To query salesforce, go to cloud connector menu on the top  and click login (if successfully logged in) then click on pull the records as shown here, this will open a dialogue box as shown  the two pictures below




Here is the result set all on the Google Spreadsheet


Code for application shown here,  could be forked from my github project

Image by- Git hub

Special thanks to +Sanjay Gidwani , +Kalyan Reddy+Google Developers  and +Salesforce

You May Also Like

0 comments