You need to sign in to do that
Don't have an account?
Just Code It
Call back Method for @future and Exception Design Pattern
Hi all,
Does anyone know if there's call back method mechanism that can be used with method declared with "@future"? Also, what's the standard exception handling design pattern for making Web Services call-outs (obviously, we need @future, which results in asynchronous calls).
Thank you for your ponter,
In future method :
Call back mechanism : No there is no call back mechanism in future methods, these methods do get executed in future and there succes and failure can only be monitored in Administration setup->Monitoring->Apex jobs
In case of any system exception , Exception mail notification will be send,
Exception Handling: Now in most cases there is no need of exception handling in future method as no excetion will come to users screen in any case. But if you still want to do it you can use try catch block. In that case exception mail will not be send.
All Answers
You can try using triggers or workflow field update once your future method is completed. Some good links to help you out working with Web service :
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_annotation_future.htm
http://wiki.developerforce.com/index.php/Apex_Web_Services_and_Callouts
http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_concepts_errorhandling.htm
Thanks
Ankit Arora
Blog | Facebook | Blog Page
In future method :
Call back mechanism : No there is no call back mechanism in future methods, these methods do get executed in future and there succes and failure can only be monitored in Administration setup->Monitoring->Apex jobs
In case of any system exception , Exception mail notification will be send,
Exception Handling: Now in most cases there is no need of exception handling in future method as no excetion will come to users screen in any case. But if you still want to do it you can use try catch block. In that case exception mail will not be send.
Hi,
The best strategy is to create an object called 'Application Log'. This log object should contain a lookup to user, time of exception, exception message, stack trace and one more- a lookup to case.
Then put try..catch block in future method. In case of exception create a log object. Create a case with a pre-configured (custom setting) user as the case owner. Set that case id in new application log record.
Then, a trigger on case can remove that record on closing that case.
This will given an efficient issue tracking feature also.
Thanks
Shabu