You need to sign in to do that
Don't have an account?
RedBear
How to refresh current page when @future method completes
Hi:
I have an @future method (called from a trigger, makes a callout). This method is invoked from the quotes page in a before update trigger, and updates a custom field on the quotes page under certain conditions.
I would like the method to refresh or reload the quote page when it is complete. Is there a way to do this from Apex?
Thanks in advance for any tips, tricks, etc.
Hi:
Thanks a lot for the reply and the suggestions. I certainly will check into the streaming API and the preview program. Unfortunately, we are forced to stick to existing features, as we are already listed on the appexchange. The app is an integration to quotes which calls a webservice to calculate sales tax - see http://appexchange.salesforce.com/listingDetail?listingId=a0N30000004foF2EAI for the app, or http://appexchange.salesforce.com/listingDetail?listingId=a0N30000004ceaCEAQ for an APEX SDK to write your own similar integration.
I'm not sure how the Quotes Page would "poll", but that sounds like it would suffice for our purposes for now. Could you kindly expand upon the logistics of the polling? Also how the polling process might be started from a trigger.
Regards
All Answers
You won't be able to do this from Apex, as the @future method is disconnected from any page due to its asynchronous nature. The best I've been able to achieve is to have the @future method update a field on the quote record, and have the page poll the server until the value changes.
This also sounds like a potential use case for the streaming api, so you may want to look at participating in the developer preview for that.
Hi:
Thanks a lot for the reply and the suggestions. I certainly will check into the streaming API and the preview program. Unfortunately, we are forced to stick to existing features, as we are already listed on the appexchange. The app is an integration to quotes which calls a webservice to calculate sales tax - see http://appexchange.salesforce.com/listingDetail?listingId=a0N30000004foF2EAI for the app, or http://appexchange.salesforce.com/listingDetail?listingId=a0N30000004ceaCEAQ for an APEX SDK to write your own similar integration.
I'm not sure how the Quotes Page would "poll", but that sounds like it would suffice for our purposes for now. Could you kindly expand upon the logistics of the polling? Also how the polling process might be started from a trigger.
Regards
You won't be able to start polling from a trigger, as the trigger has no knowledge of the page that it came from.
Is this using a quote standard page or a visualforce page? If the former, you'd need to add a visualforce component to it somewhere, as the polling would be carried out via an apex:actionpoller. Does the user have to do anything to start the web service call, or does that just happen automatically when a record is saved?
Being beginner to force, as a webdeveloper in pure html/ javascript refresh page can be done in way explained at http://easyhowtodo.com/how-to-refresh-a-page/