[SalesForce] Activate an InActive Trigger using the Force.com IDE

Trigger code :

trigger SetFieldsOnContact on Contact(before insert){
    System.debug('------------inside contact trigger SetFieldsOnContact before insert---------');
    String accId = [SELECT Id from Account WHERE Name='GenePoint'].Id;
        for(Contact c : Trigger.new){
        c.Description='This contact updated.';
        if(c.AccountId == null){
        c.AccountId = accId;

Execute Anonymous code :

List<Contact> contList = new List<Contact>();
for(Integer j=0;j<200;j++){
Contact c = new Contact();
c.FirstName = 'Trigger Contact'+j;
c.LastName = 'Trigger Contact'+j;
insert contList;

Issue : Fields on inserted contacts are not getting updated.

Best Answer

The trigger will need to be activated in order to run. You can do this from Developer -> Apex Triggers -> Edit next the name of your trigger. There is a checkbox called "isActive". Assure that this is checked.

You can also edit it with the Force.com IDE by modifying the metadata file for the given trigger. Change status from "InActive" to "Active".

<?xml version="1.0" encoding="UTF-8"?>
<ApexTrigger xmlns="http://xxxxxxxxxxxxx">
Related Topic