Apex Interactive Debugger
Apex Interactive Debugger
The Apex Interactive Debugger is a developer tool to debug our code step by step (like .net and java Breakpoint). You can see the real time variable result in Force.com IDE in Eclipse. It is generally available now.
If your organization has purchased debugging capability, all of the sandboxes spawned from it are enabled for debugging. The number of sessions you purchase represents the number of your sandboxes that can be debugging at the same time.
Pros:
- You can use this feature in all your sandbox(Full, Partial, Developer).
- Assign “Apex Dubug” permission to user via PermissionSet
- Use Force.com IDE in Eclipse to start debug
- Set breakpoint any line of apex class and trigger and Test class.
Cons:
- Debugger session not available on production instance.
- Only Eclipse with Force.com IDE supported
- Does not work for Batch Apex and Scheduled Job
- Can’t set breakpoint in Visualforce Page.
- 1 debugger session at a time per sandbox org.
Note: Need to contact Salesforce to enable this feature(not feature license). There is cost involved.
How to setup Apex Debugger in your sandbox?
Step 1: Contact Salesforce to enable the Apex Debugger
Step 2: Install/Update the Force.com IDE in your eclipse
- Click Next and proceed with the installation.
- Click Add, and add this update site. https://developer.salesforce.com/media/force-ide/eclipse42/
- In the Name and Version list, select all items named Force.com IDE and Force.com IDE Debugger.
- Select Force.com IDE and Force.com IDE Debugger
- Click Next and proceed with the installation.
Step 3: Create Permission Set
- Create a permission set. Give it a name that you can remember, such as Debug Apex.
- In the “Select the type of users who will use this permission set” section, choose
- None from the User License drop-down list. Choosing None lets you assign the permission set to more than one type of user.
- Save your changes.
- Click System Permissions.
- Click Edit.
- Enable the Debug Apex permission.
- Save your changes.
- Click Manage Assignments.
- Click Add Assignments.
- Select the users to whom you want to assign the permission set, and then click Assign.
Step 4: Create project in Eclipse
- In Eclipse, select File | New | Project | Force.com | Force.com Project | Next.
- Enter a descriptive project name and your Salesforce sandbox org’s credentials. Choose Sandbox from the Environment drop-down menu.
- Once Project is created – Select “work Online”. Right click Project –> Force.Com | Work Online.
Step 5: Debugger setup on Eclipse
- choosing Window | Open Perspective | Other | Debug.
- Click the debug icon debug icon in the toolbar and select debug configurations.
- Select Remote Apex Debugger.
- To create a configuration for your project, click the New launch configuration icon.
- Name the configuration.
- Click Browse and select your project.
- Click Apply, and then click Debug.
- Wait for few min and go to Debug window and see below yellow gear available on your newly created Debugger.
- To set breakpoint, Go to controller or trigger double click before row number.
- Go to salesforce UI and execute business process then you will see the UI stopped there and your Eclipse will have session .
- The Debugger stops at the breakpoint (1). The call stack (2) and the values of your variables (3) are displayed.
0 Comments