+ Start a Discussion
mojavemojave 

Apex view variable values

Is there a way to check a variable's value during trigger execution?  I use alerts and echo statements in javascript and PHP code to accomplish this, but haven't seen anything yet like this for apex.

 

I've written some trigger code that compiles OK, but it doesn't actually do what I want it to do, so i need to debug this somehow.

 

As a newbie, I've probably missed something really obvious here!

 

Thanks,

Kevin

 

Best Answer chosen by Admin (Salesforce Developers) 
crmexpertcrmexpert
system.debug() is the best way to debug a code..just put system.debug() in between lines of code to see the values of the fields and test whether the logic of the code is correct or not..

All Answers

JonPJonP
Check out System.debug().
crmexpertcrmexpert
system.debug() is the best way to debug a code..just put system.debug() in between lines of code to see the values of the fields and test whether the logic of the code is correct or not..
This was selected as the best answer
mojavemojave

Thanks folks, system.debug() did the trick.  At first I couldn't figure out where the results went, but then I found how to turn on the system logs in the sandbox and reset them every 20 logs to keep recording more.

 

Ah, the learning curve!