You need to sign in to do that
Don't have an account?

Question about trigger @future and screen refresh
I have a trigger that works:
trigger setGeo on CarQuotes__c (before insert, before update) {
for(CarQuotes__c Car : trigger.new)
if (Car.NeedDistance__c == True){
ZipGeoCode.getDistance(Car.Id);
}
else { Car.NeedDistance__c = True; }
}
My class ZipGeoCode works as well. It uses the @future and calls the Google api to get a driving distance and populates a field on the CarQuotes__c record.
The problem is that when you create a new record or update a record, when you click save what you see does not reflect the distance that was gathered from Google. But if you refresh or navigate away from the record and back to it, you see the distance value was in fact updated. This is deceptive for the users. Is there any way to have the trigger pause until the ZipGeoCode is finished? Or on edit/update to force the browser to refresh? So that the users view of the record after save shows the value?
All Answers
Kinds of what I thought. Thanks.