Loading

How to Create or Edit Apex Classes or Apex Triggers in Salesforce

Julkaisupäivä: Jul 14, 2025
Kuvaus

Please refer to this guide if you cannot create or edit Apex classes or triggers.

You can edit Apex classes and Apex triggers in the user interface only in Developer Edition, Sandbox, and Trial Org. For example, a developer who tries to click [Edit] on an Apex class directly inside a production org will not see that option, because production orgs restrict direct code edits through the UI. In a production org, the [Edit] button does not appear from the user interface, so use change sets, Salesforce CLI, or the Metadata API to make changes.

Ratkaisu

This article explains where you can edit Apex classes and Apex triggers directly in the UI, and how to make changes in a production org where direct editing isn't available.

Editing Apex Directly in the User Interface

You can create, edit, and delete Apex classes and Apex triggers directly in the user interface only in Developer Edition, Sandbox, and Trial Org.

Additionally, to make changes to Apex classes or Apex triggers, you must assign the “Author Apex” permission to the user.

Modifying Apex in a Production Org

In a production org, you can execute and view Apex classes from the user interface, but you cannot edit Apex classes or Apex triggers directly because the [Edit] button is not displayed on the user interface.

To modify Apex classes or Apex triggers in a production org, use change sets, Salesforce CLI, or the Metadata API.

Additional Notes

  • When migrating Apex classes or Apex triggers to a production organization, you must create a test class and meet the minimum code coverage requirements.
  • Apex classes and Apex triggers installed by managed packages cannot be edited or deleted.
Knowledge-artikkelin numero

000384997

 
Ladataan
Salesforce Help | Article