Top Banner
www.cloudanalogy.com Salesforce Expert Ajay Dubedi ajay.dubedi [email protected] +1 (415) 830-3899 Salesforce Google Map Integration
21

Salesforce Google Maps Integration

Jan 23, 2018

Download

Technology

CloudAnalogy
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Salesforce Google Maps Integration

www.cloudanalogy.com

Salesforce ExpertAjay Dubedi

[email protected] +1 (415) 830-3899

Salesforce

Google Map

Integration

Page 2: Salesforce Google Maps Integration

www.cloudanalogy.com

Description of the requirement:

Starting with description of the Project we have worked upon, there’s an app we created for searching and showing Account’s location on the Map and knowing a route map from one location to another location via some locations(Checkpoints).

Integrating Google Maps into Salesforce

Page 3: Salesforce Google Maps Integration

www.cloudanalogy.com

For the requirement we used Google maps api which is in Javascript format. There are some predefined javascript functions used in the Google map api. We used Google Maps library whoz source is coming from a link i.e., “https://maps.google.com/maps/api/”.

There are several Javascript functions we used here which are as follows:

Solution we came with:

Integrating Google Maps into Salesforce

Page 4: Salesforce Google Maps Integration

www.cloudanalogy.com

1. Function to get the current location of the User by using the browser’s location.

Integrating Google Maps into Salesforce

Page 5: Salesforce Google Maps Integration

www.cloudanalogy.com

2. We created an apex class method which will take Address of the Account as a string and will return a Geolocation for that address i.e., in Latitude and longitude of the string address passed in the function as a parameter to it.

Suppose a string will be as shown below: public Account accObj{get;set;}

Integrating Google Maps into Salesforce

Page 6: Salesforce Google Maps Integration

www.cloudanalogy.com

Now we used the below method to get the Latitude & Longitude:

Integrating Google Maps into Salesforce

Page 7: Salesforce Google Maps Integration

www.cloudanalogy.com

Integrating Google Maps into Salesforce

Page 8: Salesforce Google Maps Integration

www.cloudanalogy.com

Integrating Google Maps into Salesforce

Page 9: Salesforce Google Maps Integration

www.cloudanalogy.com

Integrating Google Maps into Salesforce

Page 10: Salesforce Google Maps Integration

www.cloudanalogy.com

We also did authentication for Google Apis in this method by passing the Access Key like this:

Integrating Google Maps into Salesforce

Page 11: Salesforce Google Maps Integration

www.cloudanalogy.com

Integrating Google Maps into Salesforce

Page 12: Salesforce Google Maps Integration

www.cloudanalogy.com

Integrating Google Maps into Salesforce

Page 13: Salesforce Google Maps Integration

www.cloudanalogy.com

Integrating Google Maps into Salesforce

Page 14: Salesforce Google Maps Integration

www.cloudanalogy.com

Integrating Google Maps into Salesforce

Page 15: Salesforce Google Maps Integration

www.cloudanalogy.com

Integrating Google Maps into Salesforce

Page 16: Salesforce Google Maps Integration

www.cloudanalogy.com

Integrating Google Maps into Salesforce

Page 17: Salesforce Google Maps Integration

www.cloudanalogy.com

Integrating Google Maps into Salesforce

Page 18: Salesforce Google Maps Integration

www.cloudanalogy.com

Integrating Google Maps into Salesforce

Page 19: Salesforce Google Maps Integration

www.cloudanalogy.com

Integrating Google Maps into Salesforce

Page 20: Salesforce Google Maps Integration

www.cloudanalogy.com

This Code will get User’s location from browser on load of the page and it will be stored in Start as “My location”. See below:

For Directions services we used “directionsService.route(request, function(response, status) { }” function.

Integrating Google Maps into Salesforce

Page 21: Salesforce Google Maps Integration

www.cloudanalogy.com

MANY THANKS !