ApexTrigger

Represents an Apex trigger.

Note
Although Apex classes and triggers have the Create and Update field properties, a runtime exception occurs if you try to create or update them using the API. Instead, use the Force.com Migration Tool, the Salesforce user interface, or the Force.com IDE to create or update Apex classes or triggers.

Supported Calls

create(), delete(), describeSObjects(), getDeleted(), getUpdated(), query(), retrieve(), update(), upsert()

Fields

Field Details
ApiVersion
Type
double
Properties
Create, Filter, Sort, Update
Description
The API version for this trigger. Every trigger has an API version specified at creation.
Body
Type
textarea
Properties
Create, Nillable, Update
Description
The Apex trigger definition.

Limit: 1 million characters.

bodyCrc
Type
double
Properties
Create, Defaulted on create, Filter, Nillable, Sort, Update
Description
The CRC (cyclic redundancy check) of the class or trigger file.
IsValid
Type
boolean
Properties
Create, Defaulted on create, Filter, Group, Sort, Update
Description
Indicates whether any dependent metadata has changed since the trigger was last compiled (true) or not (false).
LengthWithoutComments
Type
int
Properties
Create, Filter, Group, Sort, Update
Description
Length of the trigger without comments
Name
Type
string
Properties
Create, Filter, Group, Sort, Update
Description
Name of the trigger.

Limit: 255 characters

NamespacePrefix
Type
string
Properties
Filter, Group, Nillable, Sort
Description
The namespace prefix associated with this object. Each Developer Edition organization that creates a managed package has a unique namespace prefix. Limit: 15 characters. You can refer to a component in a managed package by using the namespacePrefix__componentName notation.

The namespace prefix can have one of the following values:

  • In Developer Edition organizations, the namespace prefix is set to the namespace prefix of the organization for all objects that support it. There is an exception if an object is in an installed managed package. In that case, the object has the namespace prefix of the installed managed package. This is the namespace prefix of the Developer Edition organization of the package developer.
  • In organizations that are not Developer Edition organizations, NamespacePrefix is only set for objects that are part of an installed managed package. There is no namespace prefix for all other objects.
Status
Type
picklist
Properties
Create, Filter, Group, Restricted picklist, Sort, Update
Description
The current status of the Apex trigger. The following string values are valid:
  • Active—The trigger is active.
  • Inactive—The trigger is inactive, but not deleted.
  • Deleted—The trigger is marked for deletion. This is useful for managed packages, because it allows a class to be deleted when a managed package is updated.
Note
Inactive is not valid for ApexClass. For more information, see the Force.com Metadata API Developer's Guide.
TableEnumOrId
Type
picklist
Properties
Create, Filter, Group, Nillable, Restricted picklist, Sort, Update
Description
Specifies the object associated with the trigger, such as Account or Contact.
UsageAfterDelete
Type
boolean
Properties
Create, Filter, Update
Description
Specifies whether the trigger is an after delete trigger (true) or not (false).
UsageAfterInsert
Type
boolean
Properties
Create, Filter, Update
Description
Specifies whether the trigger is an after insert trigger (true) or not (false).
UsageAfterUndelete
Type
boolean
Properties
Create, Filter, Update
Description
Specifies whether the trigger is an after undelete trigger (true) or not (false).
UsageAfterUpdate
Type
boolean
Properties
Create, Filter, Update
Description
Specifies whether the trigger is an after update trigger (true) or not (false).
UsageBeforeDelete
Type
boolean
Properties
Create, Filter, Update
Description
Specifies whether the trigger is a before delete trigger (true) or not (false).
UsageBeforeInsert
Type
boolean
Properties
Create, Filter, Update
Description
Specifies whether the trigger is a before insert trigger (true) or not (false).
UsageBeforeUpdate
Type
boolean
Properties
Create, Filter, Update
Description
Specifies whether the trigger is a before update trigger (true) or not (false).
UsageIsBulk
Type
boolean
Properties
Create, Filter, Update
Description
Specifies whether the trigger is defined as a bulk trigger (true) or not (false).
Note
This field is not used for Apex triggers saved using Salesforce.com API version 10.0 or higher: all triggers starting with that version are automatically considered bulk, and this field will always return true.

Usage

For more information about Apex triggers, see the Force.com Apex Code Developer's Guide.

© Copyright 2000–2014 salesforce.com, inc. All rights reserved.
Various trademarks held by their respective owners.