We have seen lots of code for google map implementation. But, all codes are for Visualforce pages. Users created a visualforce page and classes for implement google map. But,
Today I introduce you how you implementation of google map on a Field.
For This, you will need to create a Custom Label with these values -
Name : GApiKey
Short Description : GApiKey
Value : BbiTjwR8z1eBST0mNpJvtWvmgvEdrgGXs5szHHahQdD86Zd50nyAzG0QAkxwmgieQrLQ
Then create a Formula field ( type - text) with this formula value -
IMAGE(
"http://maps.google.com/maps/api/staticmap?center=" + BillingStreet + "," + BillingCity + "," + BillingState + " " + BillingPostalCode +"&zoom=13&size=650x250&markers=color:blue|" + BillingStreet + "," + BillingCity + "," + BillingState + " " + BillingPostalCode + "&sensor=false&format=png32&key=" + $Label.GApiKey
, "no map available", 250, 650)
After adding this field in a object page payout, Result will shows like -
Today I introduce you how you implementation of google map on a Field.
For This, you will need to create a Custom Label with these values -
Name : GApiKey
Short Description : GApiKey
Value : BbiTjwR8z1eBST0mNpJvtWvmgvEdrgGXs5szHHahQdD86Zd50nyAzG0QAkxwmgieQrLQ
Then create a Formula field ( type - text) with this formula value -
IMAGE(
"http://maps.google.com/maps/api/staticmap?center=" + BillingStreet + "," + BillingCity + "," + BillingState + " " + BillingPostalCode +"&zoom=13&size=650x250&markers=color:blue|" + BillingStreet + "," + BillingCity + "," + BillingState + " " + BillingPostalCode + "&sensor=false&format=png32&key=" + $Label.GApiKey
, "no map available", 250, 650)
After adding this field in a object page payout, Result will shows like -
I created a Location name formula field for demo to show Google Map on Field.
Here the link for online demo:
Hi,
ReplyDeleteIs this all you have to do? I successfully created the new Label, then try to create a Custom Field under the Account object (I tried Contacts too), copying and pasting your formula into the field. I receive this syntax error:
Error: Field BillingStreet may not be used in this type of formula
Any thoughts on what's going on here?
Please can you share you code and screen shot. Because we was applied this Its works fine. Please share you code.
DeleteI did as you said but I got the no map available message. Strange. It looks great if I could get it to work. Very neat.
ReplyDeleteHello Aidy,
ReplyDeleteHave You created a Custom label or not with the same value?
If yes, please can you share your code. I will try to figure out the problem.
Thanks
@aidy @ Raj Jha don't you need your own GApiKey for this to work? Also, try https: instead?
ReplyDelete@Raj n Andrew,
ReplyDeleteEven after using my own GApi Key n using Https, Still not able to get the maps
Could you help me to know why is this so.?
Hi All,
ReplyDeleteI know lots of persons are facing same problem. But guys this formula work for me.
Please can you all do little bit of change. Remove the API key from formula. Because all are facing problem in API. I have tried this formula after remove the API and its still working. Please guys replace with new formula -
IMAGE(
"http://maps.google.com/maps/api/staticmap?center=" + BillingStreet + "," + BillingCity + "," + BillingState + " " + BillingPostalCode +"&zoom=13&size=650x250&markers=color:blue|" + BillingStreet + "," + BillingCity + "," + BillingState + " " + BillingPostalCode + "&sensor=false&format=png32" , "no map available", 250, 650)
Thanks,
-Raj
Thanks alot for sharing it. It worked with your updated formula
ReplyDeletewhat code would i have to change to see the streetview?
ReplyDelete@jharaj This isnt working out for me. I get a "no map available" error.
ReplyDeleteAny suggestions?
Thanks,
Rithu
hi! Can You please help me out I am also getting the same error even after using the last formula it's still showing no map available.
Delete