Was responding to questions in the Answer Community today and this one came up from former co-worker Richard Henry.
This was his idea, I merely assisted in figuring out the formula, but it was such a great use case had to write it up! I’ve seen formulas to add Google Map images to custom addresses, but this formula takes it a step further, allowing you make those images clickable and load within Google Maps.
First – create your 4 custom address fields (or 5 if you want to specify country). In this case, I created four on my custom object, ‘Campsite.’
Next add the following in a formula text field (replace my api names for your own) if you want to display the address above the image:
Site_Street__c +BR()+Site_City__c + ‘, ‘ + Site_State__c + ‘ ‘ + Site_Zip__c + BR()+HYPERLINK(‘https://www.google.com/maps/place/’+ Site_Street__c +’,’+ Site_City__c +’,’+ Site_State__c +’,’+ Site_Zip__c, IMAGE(‘http://maps.google.com/maps/api/staticmap?center&markers=color:red|=’+ Site_Street__c + Site_City__c + Site_State__c + Site_Zip__c + ‘&zoom=15&size=310×175&markers=color:red|’ + ‘&sensor=false&format=png32’ , ‘no map available’, 175, 310))
The result will be a formatted address displayed above a static google map image on your page AND that image is clickable, taking you to the google map site. See below – this state park & campground happened to be my very first job at 14 years old – I rode my bike 6 miles each direction so I can save up enough money to buy a beat-up, brown two-tone 1985 Pontiac 6000 when I turned 16.
When you click on the image it takes you to the google maps site.
Or this one if you just want the clickable image:
HYPERLINK(‘https://www.google.com/maps/place/’+ Site_Street__c +’,’+ Site_City__c +’,’+ Site_State__c +’,’+ Site_Zip__c, IMAGE(‘http://maps.google.com/maps/api/staticmap?center&markers=color:red|=’+ Site_Street__c + Site_City__c + Site_State__c + Site_Zip__c + ‘&zoom=15&size=310×175&markers=color:red|’ + ‘&sensor=false&format=png32’ , ‘no map available’, 175, 310))
The result will be a static google map image on your page AND that image is clickable, taking you to the google map site.
This next one is for Andrés Gluecksmann – obviously it’s still flawed, but its a little closer to the dream – be sure to click the link & keep voting for this idea!
Create a quick action, type ‘Update a Record’ and add your 4 address fields to the page layout, give it a label like ‘Update Address.’ Add it to the page layout, remove your address fields from the main page layout and then use the formula that displays the address block above the map:
Site_Street__c +BR()+Site_City__c + ‘, ‘ + Site_State__c + ‘ ‘ + Site_Zip__c + BR()+HYPERLINK(‘https://www.google.com/maps/place/’+ Site_Street__c +’,’+ Site_City__c +’,’+ Site_State__c +’,’+ Site_Zip__c, IMAGE(‘http://maps.google.com/maps/api/staticmap?center&markers=color:red|=’+ Site_Street__c + Site_City__c + Site_State__c + Site_Zip__c + ‘&zoom=15&size=310×175&markers=color:red|’ + ‘&sensor=false&format=png32’ , ‘no map available’, 175, 310))
This also works for incomplete addresses, see my example using Yellowstone National Park:
I tried this today in sandbox, and never got an image. I get, “no map available” with just a small thumbnail. It is clickable, & goes where desired, but no image.
I tried adding in API key in the image url, but no go. Any suggestions (My State__c field is a picklist & I’m pulling that in via TEXT(State__c) . Again – the link works, but no image.
Hey Bruce – I’ll send you an email to follow-up. Can troubleshoot & then post back our fix.
For those interested – you can include a Text() reference for your state/country picklists, Bruce & I got his working (though we are not sure what we did!)
Hi, I have the same issue that Bruce had. The hyperlink is working but image is not showing. Any ideas how to solve this?
Thankyou!
Can you share your formula – also, want to make sure you are using this on the page layout of a record (it won’t work in places like quick actions, related lists, etc).
NO MAP AVAILABLE!
FORMULA THAT I USED:
Site_Street__c +BR()+Site_City__c + “,” + Site_State__c + “,” + Site_Zip__c + BR()+
HYPERLINK(“http://www.google.com/maps/place/”+ Site_Street__c +”,”+ Site_City__c +”,”+ Site_State__c +”,”+ Site_Zip__c,
IMAGE(“http://maps.google.com/maps/api/staticmap?center&markers=color:red|=”+ Site_Street__c + Site_City__c + Site_State__c + Site_Zip__c + “&zoom=15&size=310×175&markers=color:red|” + “&sensor=false&format=png32” , “no map available”, 175, 310))
Is this a formula error OR is the address not returning a map? Can you share the address you are entering?
Hi!
I have the same issue …no image available. I use the following formula:
Ship_to_Street__c & BR()
& Ship_to_Postal_Code__c & ” ” & Ship_to_City__c & BR()
& Ship_to_Country__c
+ HYPERLINK(“https://www.google.com/maps/place/”+ Ship_to_Street__c +”,”+ Ship_to_City__c +”,”+ Ship_to_Postal_Code__c, IMAGE(“http://maps.google.com/maps/api/staticmap?center&markers=color:red|=”+ Ship_to_Street__c +”,”+ Ship_to_City__c +”,”+ Ship_to_Postal_Code__c + “&zoom=15&size=310×175&markers=color:red|” + “&sensor=false&format=png32” , “no map available”, 175, 310))
The link works as well as the text in my formula field, just not the image (I also get the broken icon). When I right click the link and choose “open image in new tab”, it states:
“The Google Maps Platform server rejected your request. Invalid request. Invalid ‘size’ parameter.”
Any ideas? Would really like this to work!
Hi , I got same error No MAPS Available and No Image is showing..
What anyone ever able to fix the no image showing issue? I’m having the same error. My formula is below.
MeetingStreet__c +BR()+MeetingCity__c + “,” + MeetingState__c + “,” + MeetingPostalCode__c + “,” + MeetingCountry__c + BR()+
HYPERLINK(“http://www.google.com/maps/place/”+ MeetingStreet__c +”,”+ MeetingCity__c +”,”+ MeetingState__c +”,”+ MeetingPostalCode__c +”,”+ MeetingCountry__c,
IMAGE(“http://maps.google.com/maps/api/staticmap?center&markers=color:red|=”+ MeetingStreet__c + MeetingCity__c + MeetingState__c + MeetingPostalCode__c + MeetingCountry__c +
“&zoom=15&size=310×175&markers=color:red|” + “&sensor=false&format=png32” , “no map available”, 175, 310))
Greetings! I am receiving the same ‘no map available’, any solution to this?
Physical_Street__c +BR()+
Physical_City__c + “, ” + TEXT(Physical_State__c) + ” ” + Physical_Zip__c + BR()
+HYPERLINK(“https://www.google.com/maps/place/”+Physical_Street__c+’,’+Physical_City__c+’,’+TEXT(Physical_State__c)+’,’+Physical_Zip__c, IMAGE(“http://maps.google.com/maps/api/staticmap?center&markers=color:red|=”+ Physical_Street__c + Physical_City__c + TEXT(Physical_State__c) + Physical_Zip__c + “&zoom=15&size=310×175&markers=color:red|” + “&sensor=false&format=png32” , “no map available”, 175, 310))
Following another string with the same ‘no map found’ error. Apparently due to google moving this to a paid feature (although it looks like you get a credit for $200 each month). See
https://trailblazers.salesforce.com/answers?id=9063A000000ihRLQAY
Hi Tom,
I was referring to your “Add Clickable Google Map to Custom Address Field”, my client is asking to have a Google Map created on Opportunity page using the Account billing address.
Could you please help me.
I used the same formula and its showing map image as broken and its not clickable. I understand Google API key is no w a paid feature. So I added API key in the formula and its still not working.
Here is the formula
HYPERLINK( “https://www.google.com/maps/place/”+ cep_Street_Number_of_Loss__c +”,”+ cep_Street_Of_Loss__c +”,”+ cep_City_Of_Loss__c +”,,” + cep_Postal_Code_Of_Loss__c,
IMAGE(“https://maps.google.com/maps/api/staticmap?key=AIzaSyDWnBOxsEh8KPWlFPaYAR9-HfNXCzUQxjo¢er&markers=color:red|=”+ cep_Street_Number_of_Loss__c + cep_Street_Of_Loss__c +
cep_City_Of_Loss__c + cep_Postal_Code_Of_Loss__c + “&zoom=15&size=310×175&markers=color:red|” + “&sensor=false&format=png32” , “Take me to Google Maps”,
175, 310))
Can anyone please assist?