Posted on

Apex environment overview

LEARN APEX

In our previous post we talked about What is Apex Programming. Now today we will discuss about Apex environment for Salesforce Apex development.

Apex environment Overview

Writing Apex Code Using Sandbox Environments

Apex code can be developed in either Sandbox or Developer edition of Salesforce.

You can run Apex in a:

  • developer org—An org created with a Developer Edition account
  • production org—An org that has live users accessing your data
  • sandbox org—An org created on your production org that is a copy of your production org

How to Create Code using Sandbox Org Apex environment

Steps to create a sandbox org:

  1. From Setup, enter Sandboxes in the Quick Find box, then select Sandboxes.
  2. Click New Sandbox.
  3. Enter a name and description for the sandbox.
  4. Select the type of sandbox you want.
  5. Select the data to include in your Partial Copy or Full sandbox.
  6. For a Partial Copy sandbox, click Next, and then select the template you created to specify the data for your sandbox.
  7. For a Full sandbox click Next, and then decide how much data to include.
  8. To include template-based data for a Full sandbox, select an existing sandbox template.
  9. To include all data in a Full sandbox, choose whether and how much field tracking history data to include, and whether to copy Chatter data.
  10. To run scripts after each create and refresh for this sandbox, specify the Apex class you previously created from the SandboxPostCopy interface.
  11. Click Create.

Writing Apex Code Using Development Environments

  • The Force.com Developer Console and the Force.com IDE allow you to write, test, and debug your Apex code.
  • The code editor in the user interface enables only writing code and doesn’t support debugging.

Force.com Developer Console

Force.com Developer Console integrated development environment with a collection of tools you can use to create, debug, and test applications in your Salesforce organization.

Steps to Open Developer Console

  • Step 1: Go to Name->Developer Console (On Top right corner)

devlopment console apex environment

  • Step2: Click on “Developer Console”

The Developer Console supports these tasks:

  • Writing code
  • Compiling code
  • Debugging
  • Testing
  • Checking performance
  • SOQL queries
  • Color coding and autocomplete

Force.com IDE

The Force.com IDE is a plug-in for the Eclipse IDE. The Force.com IDE provides a unified interface for building and deploying Force.com applications.

Install the Force.com IDE Plug-In

  1. Launch Eclipse and select Help | Install New SoftwareClick Add.
  2. In the Add Repository dialog, set the name to Force.com IDE and the location to https://developer.salesforce.com/media/force-ide/eclipse45. For Spring ’16 (Force.com IDE v36.0) and earlier Force.com IDE versions, use http://media.developerforce.com/force-ide/eclipse42. & Click OK.
  3. Select the Force.com IDE plug-in, and then click Next.
  4. In the Install Details dialog, click Next.
  5. In the Review Licenses dialog, accept the terms and click Finish.
  6. Eclipse downloads and installs the Force.com IDE and the required dependencies. When the installation is complete, you are prompted to restart. Click Yes.
  7. When Eclipse restarts, select Window | Open Perspective | Other. Select Force.com and then click OK.

How to use Apex Code Assist in Apex environment

Apex Code assist

To use code assist:

  1. Insert the cursor in the editor area.
  2. If you are typing a class or variable name, type a dot (“.”) and pause for a moment, and the proposal window opens.
  3. Select an item from the list & press Enter.

Solutions to Problems while Installing Force.com IDE

  1. No Repository Found

Solution

Configure Eclipse to use your proxy server. You can find these settings in your Eclipse Preferences under General | Network Connections.

       2. No Force.com Perspective (macOS)

Solution

Download the full version of the Java SE Development Kit (JDK) from the Java download page.

       3. No Force.com Perspective (Windows)

Solution

Add the explicit path to the JRE in the eclipse.ini file located in the directory where you installed Eclipse. Add this line: