---
schema_version: "1"
id: f5b3e5edb722377f401774287f51e7f75819a43d76c99f6620000c2053de8b82
title: Use Apex to Create Triggers
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/mktg/264-0-0/mc_co_use_apex_to_create_triggers.md
canonical_url: https://help.salesforce.com/s/articleView?id=mktg.mc_co_use_apex_to_create_triggers.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 23a74a408a841ad0a63560a2c31939c71196fc9b0132036aa66cad41304a292c
description: "A trigger is Apex code that executes before or after the following types of operations: insert, update, delete, merge, upsert, and undelete. Developer environments, sandboxes, and trial orgs can create, edit, and delete Apex classes and triggers directly in the Salesforce CRM user interface. Unlimited Edition and Enterprise Edition production orgs can execute and view Apex in the user interface, but modifying Apex in the user interface is not allowed."
products:
  - Marketing
  - Cross Cloud
release: "264"
---
# Use Apex to Create Triggers

A trigger is Apex code that executes before or after the following types of operations: insert, update, delete, merge, upsert, and undelete. Developer environments, sandboxes, and trial orgs can create, edit, and delete Apex classes and triggers directly in the Salesforce CRM user interface. Unlimited Edition and Enterprise Edition production orgs can execute and view Apex in the user interface, but modifying Apex in the user interface is not allowed.

Write Apex classes and triggers first in a developer environment, sandbox, or trial org, then tested with appropriate test methods before deploying to production. Install the Marketing Cloud Connect for Marketing Cloud Engagement package in your production org before deploying triggers to ensure that classes are referenced properly.

#### See Also

- [Introducing Apex](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_intro.htm)
- [Testing Apex](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_testing.htm)
- [Deploying Apex](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_deploying.htm)