Using the Developer Console to Execute Apex Code The Developer Console can look overwhelming , but it’s just a collection of tool s that help you work with code. In this lesson, you’ll eecute !pecode and view the results in the "og Inspector. The "og Inspector is a useful tool you’ll use often. #. Click Debug$ Open Execute Anonymous Windowor CT%"&'. (. In th e 'nter !peCo de wi ndow, enter the f ol lo wi ng tet) *ystem.debug+ -ello orld/0 *ystem.debug+/is like using *ystem.out.println+/in 1ava +or printf+/if you’ve been around a while 02/. 3ut, when you’re coding in the cloud, where does the output go4 %ead on5 6. Deselect Open Logand then click Execute.
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
8/18/2019 Using the Developer Console to Execute Apex Code
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 eecute !pe code and viewthe results in the "og Inspector. The "og Inspector is a useful tool you’ll useoften.
#. Click Debug $ Open Execute Anonymous Window or CT%"&'.
(. In the 'nter !pe Code window, enter the following
tet) *ystem.debug+ -ello orld /0
*ystem.debug+/ is like using *ystem.out.println+/ in 1ava +or printf+/ if you’ve beenaround a while 02/. 3ut, when you’re coding in the cloud, where does theoutput go4 %ead on5
6. Deselect Open Log and then click Execute.
8/18/2019 Using the Developer Console to Execute Apex Code
'very time you eecute code, a log is created and listed in the Logs panel.
Double2click a log to open it in the "og Inspector. 7ou can open multiple logs at atime to compare results."og Inspector is a contet2sensitive eecution viewer that shows the source ofan operation, what triggered the operation, and what occurred afterward. 8sethis tool to inspect debug logs that include database events, !pe processing,work9ow, and validation logic.
The "og Inspector includes prede:ned perspectives for speci:c uses.Click Debug $ Switch Perspective to select a di;erent view, or click CT%"&< toselect individual panels. 7ou’ll probably use the 'ecution "og panel the most. Itdisplays the stream of events that occur when code eecutes. 'ven a singlestatement generates a lot of events. The "og Inspector captures many eventtypes) method entry and eit, database and web service interactions, andresource limits. The event type 8*'%=D'38> indicates the eecution ofa *ystem.debug+/ statement.
8/18/2019 Using the Developer Console to Execute Apex Code
CongratulationsByou have successfully eecuted code onthe @orce.com platform and viewed the results5
Tell e ore...
-elp in the Developer Console
To learn more about the Developer Console, click "elp $ "elp Docs# inthe Developer Console.
!nonymous 3locks
The Developer Console allows you to eecute code statements on the 9y. 7ou can uickly evaluate the results in the Logs panel. The code that youeecute in the Developer Console is referred to as an anonymous block .!nonymous blocks run as the current user and can fail to compile if thecode violates the user’s object2 and :eld2level permissions. Eote that thisisn’t the case for !pe classes and triggers.
8/18/2019 Using the Developer Console to Execute Apex Code