I need to write a trigger in which callout is made to external system.If there is any exception i.e 5XX then the next request should be made after 5min from the same trigger and after 5 iteration I need to send a mailer.
closed as off-topic by Eric, Ratan Paul, Adrian Larson♦, Adam Spriggs, Vigneshwaran G Sep 19 '16 at 14:14
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions on problems in code you've written must describe the specific problem and include valid code to reproduce it. For help writing short, self-contained syntactically-valid examples, see: SSCCE.org" – Eric, Ratan Paul, Adrian Larson, Adam Spriggs, Vigneshwaran G
You have 2 options:
- use a future method, is a method that run async. here it is the documentation
- Mark a record with a flag('I use to use a checkbox') and have secheduled class to process the marked records (I use to use a batch class).Here doc of batch And Here doc of scheduled class
Here you have the doc of async process. It explain when you should use all the async types.
You can schedule an apex class that does that work for you: