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
NewportNewport 

Step through code?

Hi Guys,


I'm very sorry to post such a basic question, but I've been through the forums and docs and watched tutorials and I simply can't find the answer.

 

In APEX, how does one step through code and/or put message boxes or something similar to determine where your code has gotten to?

 

My supervisor told me to use system.debug, so I put it as the first line in my Opportunity after insert trigger (to be executed after converting a Lead). A log or two does appear when I convert a Lead and thus run my trigger, but when I click on it, there's a huge list of events and none of them have system.debug and the message I put inside.

 

(And yes, the Opportunity is most certainly being created.)

 

Do I need Eclipse? What basic thing am I missing here? Hopefully, this will be useful for other beginners like myself.

 

Thanks!

Satish_SFDCSatish_SFDC
Hi,
When you are running your Apex code, it runs on the Salesforce servers. There is no way to stop the code run and then step through the code manually as this would put too much strain on Salesforce servers.

However as you have mentioned, debug logs are how you would debug your apex code. You sprinkle some System.debug() statements in your code and then run it. After this you check the debug logs.
If the debug statements are not coming up in the debug log, probably there is an if clause and the code does not run.

Hope this helps.

Regards,
Satish Kumar
Please mark my answer as a solution if it was helpful so it is available to others as a proper solution.
If you felt I went above and beyond, please give me Kudos by clicking on the star icon.