2

After an address is updated, I would like to run the standard Geopointe Geocoder batch job (for the Delta). Is this possible to do via Apex?

I understand that they offer geopointe.API.geocodeRecord(id) but considering it makes a callout it cannot be run directly from the Trigger code itself, meaning it has to be put into a @future method. We may run into the case where the address is updated within a @future method so things would fall apart at that point.

Edit: Database.executeBatch(new Geocode_Schedule(), 100); does not work. It throws an Invalid type error.

6
  • It is still not clear what would fall apart at that point.
    – kurunve
    Commented Feb 3, 2017 at 14:27
  • You cannot call a @future method while in a @future method so it will throw an error. It is possible that a @future method could update the address, causing the Trigger to fire which in turn has to call another @future method. That would throw an error.
    – Haphazard
    Commented Feb 3, 2017 at 14:31
  • In that case you need to keep context (let future method know, that it is right in the progress of address updating for concrete record(s) )by static variable. And as far as I understand, in most cases, result of geocoding API should be the same in 2 cases, that's why such a check can be added
    – kurunve
    Commented Feb 3, 2017 at 14:34
  • A question: Geocode_Schedule is a managed package class? Does it implement Batchable interface.
    – Ashwani
    Commented Feb 3, 2017 at 14:39
  • 2
    You must run it as: Database.executeBatch(new namespace__Geocode_Schedule(), 100);
    – Ashwani
    Commented Feb 3, 2017 at 14:40

1 Answer 1

0

To run the Geopointe Geocode Delta Batch using apex, use the following line: Database.executeBatch(new geopointe.Geocode_BatchJob('account', true), 1000); (where 'account' is the Map Object). It appears that Geocode_Schedule cannot be run directly.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .