Skip to main content
Build the future with Agentforce at TDX in San Francisco or on Salesforce+ on March 5–6. Register now.
Tempo stimato

Create an Apex Class

Introduction

Apex is a strongly typed, object-oriented programming language that allows developers to execute flow and transaction control statements on the Salesforce platform.

If you’re used to Java or .NET development, you’ll find the programming in Apex fairly straightforward. If you’ve never coded before, you might be surprised by how easy it is to access and manipulate data using Apex. In this Quick Start, you'll create a simple Apex class to update old Account records.

Create an Apex Class

The Developer Console is where you write and test your code in Salesforce. We’ll take a tour of the Developer Console and Source Code Editor in just a minute.

The first step is to create an Apex class.

  1. If you haven’t already, log in to Trailhead, then launch your Trailhead Playground by clicking Launch at the bottom of this page. This opens your Trailhead Playground in a new tab.
  2. Click the setup gear Gear icon to access Setup in Lightning Experience. and select Developer Console.
  3. From the File menu, select New | Apex Class.
  4. For the class name, enter OlderAccountsUtility and then click OK.

The code in your editor looks like this:

public class OlderAccountsUtility {
}

Excellent! Now let's add a method that can find and update older Accounts.

Condividi il tuo feedback su Trailhead dalla Guida di Salesforce.

Conoscere la tua esperienza su Trailhead è importante per noi. Ora puoi accedere al modulo per l'invio di feedback in qualsiasi momento dal sito della Guida di Salesforce.

Scopri di più Continua a condividere il tuo feedback