Using the Developer Console to Execute Apex Code | Techila
1044
single,single-post,postid-1044,single-format-standard,ajax_updown_fade,page_not_loaded,,qode_grid_1300,footer_responsive_adv,hide_top_bar_on_mobile_header,qode-content-sidebar-responsive,qode-theme-ver-9.4.2,bridge,wpb-js-composer js-comp-ver-4.12,vc_responsive
 

Using the Developer Console to Execute Apex Code

USING THE DEVELOPER CONSOLE TO EXECUTE APEX CODE

Using the Developer Console to Execute Apex Code

The Developer Console can look overwhelming, but it’s just a collection of tools that help you work with code. In this lesson, you’ll execute Apex code and view the results in the Log Inspector. The Log Inspector is a useful tool you’ll use often. 1. Click Debug > Open Execute Anonymous Window or CTRL+E. 2. In the Enter Apex Code window, enter the following text: System.debug( ‘Hello World’ ); Note: System.debug() is like using System.out.println() in Java (or printf() if you’ve been around a while ;-). But, when you’re coding in the cloud, where does the output go? Read on! 3. Deselect Open Log and then click Execute.

 

USING THE DEVELOPER CONSOLE TO EXECUTE APEX CODE

 

 

 

Every time you execute code, a log is created and listed in the Logs panel.

 

USING THE DEVELOPER CONSOLE TO EXECUTE APEX CODE

 

Double-click a log to open it in the Log Inspector. You can open multiple logs at a time to compare results. Log Inspector is a context-sensitive execution viewer that shows the source of an operation, what triggered the operation, and what occurred afterward. Use this tool to inspect debug logs that include database events, Apex processing, workflow, and validation logic. The Log Inspector includes predefined perspectives for specific uses. Click Debug > Switch Perspective to select a different view, or click CTRL+P to select individual panels. You’ll probably use the Execution Log panel the most. It displays the stream of events that occur when code executes. Even a single statement generates a lot of events. The Log Inspector captures many event types: method entry and exit, database and web service interactions, and resource limits. The event type USER_DEBUG indicates the execution of a System.debug() statement.

 

USING THE DEVELOPER CONSOLE TO EXECUTE APEX CODE

 

1.       Click Debug > Open Execute Anonymous Window or CTRL+E and enter the following code:

 

System.debug( ‘Hello World’ );

System.debug( System.now() );

System.debug( System.now() + 10 );

 

2.    Select Open Log and click Execute. 3. In the Execution Log panel, select Executable. This limits the display to only those items that represent executed statements. For example, it filters out the cumulative limits. 4. To filter the list to show only USER_DEBUG events, select Debug Only or enter USER in the Filter field.

 

USING THE DEVELOPER CONSOLE TO EXECUTE APEX CODE

 

 

Courtesy:- https://resources.docs.salesforce.com/sfdc/pdf/workbook_vf.pdf

“Explore – Techila Global Services, A Salesforce development company”

Author: techila

No Comments

Post A Comment