function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
duke1duke1 

@future method called but not entered

I have a trigger calling an @future method.  The trigger fires correctly, it correctly calls the @future method (processCarsTrans(SET <Id>), see below), but it appears the code inside the @future method never runs.  The first line in processCarsTrans is a System.debug line, which does not appear in the System log.  All I see in the log is:

 

10:12:54.502|METHOD_ENTRY|[35,13]|01pQ00000004lsH|SumCarsTransMethods.processCarsTrans(SET<Id>)
10:12:54.643|METHOD_EXIT|[35,13]|SumCarsTransMethods.processCarsTrans(SET<Id>)

 

It appears no code has run in the processCarsTrans method.  Shouldn't I be able to see the same kind of log with an @future method as I do with one that is not @future?  In the Syetem Log I do not a FUTURE line, indicating the async code is ever getting executed.  How do I get this @future method to run and log its behavior so I can test it?

 

 Any help is greatly appreciated.

Best Answer chosen by Admin (Salesforce Developers) 
JimRaeJimRae

Your future method is probably running, but the debug is not available from the system log.

What you can do is add a debug monitor for yourself, this will be able to capture the output of your future session.

To do this, go into Setup, App Setup, Monitoring  and select "Debug Log"

Add a new session for your self, and then rerun your test.  if you go back to the monitor area, you will see the items you have executed, and their debug logs will be available, including the future method.

All Answers

JimRaeJimRae

Your future method is probably running, but the debug is not available from the system log.

What you can do is add a debug monitor for yourself, this will be able to capture the output of your future session.

To do this, go into Setup, App Setup, Monitoring  and select "Debug Log"

Add a new session for your self, and then rerun your test.  if you go back to the monitor area, you will see the items you have executed, and their debug logs will be available, including the future method.

This was selected as the best answer
duke1duke1

Thank you very much!