I get an 'Apex Class Invalid' error

Last published at: 2023-03-31 16:22:27 UTC


When using the 'Run an Apex Class' action, I get an error message stating 'Apex Class invalid'.


Recompiling your classes will solve this:

  1. Go to Salesforce Setup > Apex Classes
  2. At the Apex Classes main page, click Compile All Classes

To prevent this from happening again, enable compiling upon deploy:

  1. Go to Salesforce Setup > Apex Settings
  2. Enable Perform Synchronous Compile on Deploy
  3. Click Save