

- #Visual studio shortcuts toggle through methods update#
- #Visual studio shortcuts toggle through methods code#
After a few seconds, Visual Studio Code opens the downloaded debug log.

With our breakpoints and checkpoints set, it’s time to rerun our Apex test to generate a replay-enabled debug log. For this project, you must set at least the checkpoint mentioned above in AccountService.cls.īe sure to generate debug logs and replay them with Apex Replay Debugger soon after updating your checkpoints, because checkpoints expire after 30 minutes and heap dumps expire after a day. You can set as many breakpoints as you like, but you can only set up to five checkpoints at a time. If you modify your Apex code or toggle checkpoints, run this command again to stay in sync. You must tell Salesforce about your checkpoints so that heap dumps are collected as your Apex code executes.
#Visual studio shortcuts toggle through methods update#
Open the Command Palette and enter sfdx checkpoint in the search box, then choose SFDX: Update Checkpoints in Org.You should see an indicator next to the line number showing that the checkpoint was set. Enter sfdx checkpoint in the search box, then choose SFDX: Toggle Checkpoint.Alternatively, you can use the keyboard shortcut Ctrl+Shift+P (Windows or Linux) or Cmd+Shift+P (macOS) to open the Command Palette. Click the View menu then choose Command Palette.In Visual Studio Code, open the AccountService.cls file and focus your cursor on the line with the return newAcct statement.To distinguish a breakpoint from a checkpoint, breakpoints display as a solid red dot and checkpoints display as a red circle with a line through the center. Breakpoints and checkpoints display an indicator next to the line number to show they’ve been set. Use the Debug: Toggle Breakpoint and SFDX: Toggle Checkpoint commands to toggle on and off breakpoints and checkpoints, respectively. Compared to breakpoints, checkpoints provide richer information for all local variables, static variables, and trigger context variables. Checkpoints, a special feature for debugging Apex code, are a type of breakpoint that provides more information by capturing heap dumps. When debugging, a breakpoint instructs the running program to pause at a specific line number so the developer can inspect variable values at that point in time. Let’s set a checkpoint in the code, rerun the test to collect a debug log, then replay the debug log to find our code bug 🐞. The error message indicates the wrong value was assigned to the account’s ticker symbol field. Note the test result outcome in the Output panel.Enter apex test in the search box, then choose SFDX: Run Apex Tests.In Visual Studio Code, click the View menu then choose Command Palette.

If the SFDX: Deploy Source to Org option is unavailable, ensure you authorized your Trailhead Playground as an org with Salesforce CLI per the previous step.
