+ Start a Discussion
Jeremiah CochranJeremiah Cochran 

Generate random Geolocation

I'm trying to generate random geolocation codes and assign them to a record when it is created, These records are simply dummy data to use for testing purposes but for my test to work properly I need to set random geolocation codes. Here is what I have so far, but I can't get the geocode to generate:
List<Location__c> locat = new List<Location__c>();
for (Integer a = 0; a <5; a++) {
  locat.add(new Location__c(Location_Name__c = 'Location ' + a ));
	locat.GeoCode__Latitude__s = getRandomInteger();
    locat.GeoCode__Longitude__s = getRandomLong();

insert locat;

sravan velamasravan velama
Hi Jeremiah,

Try to insert like this

locat.GeoCode__Latitude__s = 80.2739;
locat.GeoCode__Longitude__s  = 13.0429;