0

We are wanting to use Geolocation in an effort to get physical address more precise at the account level, but it is split into Latitude and Longitude when you enter in the geocode which is erroring out. We are wanting people to simply copy and paste i.e. the google location code into it and have it auto update address.

3
  • GEOLOCATION( ShippingLatitude , ShippingLongitude ) I get this error Error: Formula result is data type (Location), incompatible with expected data type (true or false). – iamjury Feb 2 '16 at 3:03
  • if I am not wrong you want account address to be updated based on the value entered in latitude and longitude right? – Kiran Machhewar Feb 2 '16 at 3:05
  • That would be fantastic yes, – iamjury Feb 2 '16 at 3:17
0

If you want to do reverse geocodeing i.e. getting address of lat, long then you need to make api call and parse json in order to get address. E.g. http://maps.googleapis.com/maps/api/geocode/json?latlng=-36.922970,174.792207&sensor=true

By hitting above url you would be able to pull address:

"formatted_address" : "64-68 Victoria St, Onehunga, Auckland 1061, New Zealand",
         "geometry" : {
            "bounds" : {
               "northeast" : {
                  "lat" : -36.9223577,
                  "lng" : 174.7923878
               },
               "southwest" : {
                  "lat" : -36.9245029,
                  "lng" : 174.7921219
               }
            },
            "location" : {
               "lat" : -36.9229721,
               "lng" : 174.7921807
            },
            "location_type" : "RANGE_INTERPOLATED",
            "viewport" : {
               "northeast" : {
                  "lat" : -36.9220813197085,
                  "lng" : 174.7936038302915
               },
               "southwest" : {
                  "lat" : -36.9247792802915,
                  "lng" : 174.7909058697085
               }
            }
         },

Your interested value is present in formatted_address field. From implenation perspective you can use callout enabled future methods triggering from trigger whenever someone updates location lat long in account. Hope this helps you.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.