Troubleshooting the Trailhead Validator

Anyone who’s done an interactive Salesforce Trailhead module knows that the validation can be… vague. A few weeks ago, I discovered the validation is executing anonymous as your user. Not only will these show up in the debug logs of your org, but you can see the code that ran (and thus run it yourself).

Steps

  1. Go to Setup > Debug Logs.
  2. Create a new log for your user. The default log levels should be fine.
  3. Run the validator in Trailhead.
  4. Refresh the debug log page and view the latest entry. You should see the first lines display the code that was run.
  5. (Optionally) Use a text editor to trim the lines, and then run them yourself in the developer console to troubleshoot the assertions in real time.

You can also discover how extra data or something else in your org is messing with the expected validations. Interesting!