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).
- Go to Setup > Debug Logs.
- Create a new log for your user. The default log levels should be fine.
- Run the validator in Trailhead.
- Refresh the debug log page and view the latest entry. You should see the first lines display the code that was run.
- (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!