Loading

Disable a Salesforce Trigger in a Production Environment

Publiseringsdato: May 16, 2026
Beskrivelse

Apex triggers in Salesforce contain automated business logic that fires on DML (Data Manipulation Language) operations such as insert, update, delete, and undelete. Once deployed to a production org, triggers cannot be directly edited or toggled through the Salesforce Setup UI — they must be deployed via metadata tooling.
In certain circumstances, such as during a large data migration or an emergency fix, there may be a need to temporarily or permanently disable an Apex trigger in production. This article explains the supported methods to disable a Salesforce trigger in a production org.
Example scenario: An Apex trigger on the Opportunity object is causing failures during a large data migration. To allow the migration to complete, a system administrator needs to temporarily disable the trigger, run the migration, then re-enable it.
Note: Consider the consequences of disabling a trigger in the production environment during work hours. It is highly recommended to perform this during off-hours. Also, disable access to the application to non-administrators during the maintenance period.

 

Løsning

Turn Off a Trigger in a Production Org

Via Salesforce CLI

  1. Create a package.xml file to retrieve the metadata of the trigger
  2. Authorize the org where you want to deactivate the trigger using the command sf org login web
  3. Use the sf project retrieve start command to retrieve the trigger metadata using the package.xml file created earlier
  4. Once the metadata file is retrieved, open the triggername.trigger-meta.xml file and change the status from Active to Inactive
  5. Run the sf project deploy start command to deploy the changes to the target org

 

Via Change Sets

  1. Disable the trigger in a sandbox environment. You should have a sandbox org which contains the same trigger.
  2. Create a new Outbound Change Set in the sandbox.
  3. Add the disabled trigger to the change set.
  4. Upload the change set to your production org.
  5. In production, go to the Inbound Change Sets and wait for the uploaded change set to be available.
  6. Click Deploy to run the tests and apply the changes.

To see this information in video format, watch
 
How to Disable a Trigger in a Production Org via Change Set.

Via Workbench

  1. Retrieve the trigger metadata using Workbench
  2. Unzip the retrieved metadata folder
  3. In the triggername.trigger-meta.xml file, change the status from Active to Inactive
  4. Zip the folder back and deploy it using Workbench

 

Via Ant Migration Tool (Retired — Not Recommended)

  1.  Disable the trigger in the sandbox environment.  You should have a sandbox org which contains the same trigger.
  2. Create a new folder using the sandbox and include the trigger (or refresh yor existing folder)
    1. Alternative: edit the triggername.trigger-meta.xml in an existing project and change the status node to false: <status>Inactive</status>
    2. Save the change locally 
    3. Deploy the trigger to production
  3. Complete the data load
  4. If the change is not permanent or you want to enable the trigger again, then enable the trigger by making it active on the sandbox or project again and deploy it to production.

Note: The Salesforce Ant Migration Tool is retired in the Spring of 2024.  T

Important: The Salesforce Ant Migration Tool was retired in Spring 2024 and is no longer supported or updated with new functionality. The steps above may still function for existing API versions but Salesforce recommends switching to Salesforce CLI for all metadata deployments. For more information, see Salesforce Ant Migration Tool End of Life.
Knowledge-artikkelnummer

000385540

 
Laster
Salesforce Help | Article