Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

When I get an error on some of my @future methods and would like to dynamically rerun the records that have failed at a later stage or have a list of records that failed and click rerun button to rerun the original transaction.

Is there any way I can rerun a failed Apex Async Job?

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

Unfortunately the answer is no, nor does Salesforce retain the information to do so I suspect. If you want to implement retry/recovery logic you will have to build this in yourself.

Using Batch Apex lends itself to this more easily since it drives most of its state from the records in your objects. Thus enabling you to implement some kind of status on such objects that allow your users to review and retry failed records more easily (perhaps via a List View filter and button).

Implementing Batch Apex or @future requires more consideration than is first apparent, when you consider failures, both of a system level and validation logic due to data errors. I've tried to capture some of the considerations I tend to keep in mind in this blog post.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.