[SalesForce] Debug or view status of a @future method

Can I see the errors or debug messages my @future calls may be generating? How can I see if a @future method was executed at all?

Details: I have a trigger which needs to update some User accounts in addition to doing a lot of things. Unfortunately, updating User objects cannot happen in the trigger and I have to update the users in a @future method.

The problem is that the code to update User objects doesn't work. First, I noticed that I wasn't querying a couple columns I was using, and I fixed that. But this is just me "guessing" what the error could have been. There is probably a better way to discover the error here.

Best Answer

Future methods can be debugged in two ways. First, you can open the developer console and perform the action that causes the future method to be called. Second, you can enable debug logs in Setup / Monitoring / Debug Logs.

As for telling if they have executed, check out Setup / Monitoring / Apex Jobs. They will appear here with a status.

Related Topic