You need to sign in to do that
Don't have an account?
Angie Yzaguirre
latitude and longitude
Hello - I have researched and researched and researched some more on how to do the following: Pull the Google geolocation latitude and longitude coordinates into a field that I can report on.
I used the code here (http://blog.elieperez.net/geocode-your-record-salesforce/) and I was able to come up with the Visualforce page and find the coordinates that will populate if the user manually pushes a button in the account:
All I want to do is pull the coordinates into a field that I can report on. Is this possible and can someone please help out with the code? I am new to the code.
Thank you!
I used the code here (http://blog.elieperez.net/geocode-your-record-salesforce/) and I was able to come up with the Visualforce page and find the coordinates that will populate if the user manually pushes a button in the account:
All I want to do is pull the coordinates into a field that I can report on. Is this possible and can someone please help out with the code? I am new to the code.
Thank you!
You can save the above class and then execute the batch via execute anonymous by running the below
BatchLatLongGenerator bJob = new BatchLatLongGenerator();
Database.executeBatch(bJob,10);
All Answers
You can save the above class and then execute the batch via execute anonymous by running the below
BatchLatLongGenerator bJob = new BatchLatLongGenerator();
Database.executeBatch(bJob,10);
I am a bit confused on a few things:
1- I copy/pasted the code into an Apex Class and got a few errors, should I be copying the entire code you posted?
2- I see the coordinates in the code from the snapshot picture I attached as an example.
3- After I figure out how to save the above class, how do I execute the batch via execute anomymous? Where am I supposed to do that part?
Thank you for your time!!
Create a new Apex Class with name 'BatchLatLongGenerator" and copy the entire code and save it. (you should not get any errors)
To execute the code, you can,
1. Open Developer Console --> Debug --> Open Execute Anonymous Window , copy /paste the 2 lines and click execute. You will receive email after the job is done.
Also, after the code has been executed, where would the fields be located that show the latitude and longitude coordinates for each account?
Do you know what this means or how I can fix it?
The BillingLatitude and BillingLongitude are the standard fields that should be available to you on account by default, you dont have to create them again. But if you want to show them, you need to have a formula field. Maybe the below post will help.
http://salesforce.stackexchange.com/questions/49668/how-to-display-location-part-of-address-field-type
Coming to the code above, the code should execute fine and get the latitude and longitude for you without any issues. Have you added "https://maps.googleapis.com" to remote site settings? if not please add and try execute
BatchLatLongGenerator bJob = new BatchLatLongGenerator();
Database.executeBatch(bJob,10);
in anonymous again.
It shouldnt take a long before you receive an email.
I just have one more question. I noticed that when I change the billing address, the coordinates do not automatically change as well and they only change after I execute the code again. Is there a way to automate this or the code needs to re-executed every time I need to pull coordinates?
Thank you again!!
You can schedule the job to run or build a trigger that calls the code
Can you guide me a bit more on this?
Thank you!