0

尝试更新联系人对象时收到此错误。

触发器:System.Exception:代码语句过多:200001

扳机 :

trigger Points_FromContact_Trigger on Contact (after delete, after update) {
    //This is an empty list of contacts that will contain all General contacts from our DML action
    List<Contact> contacts = new List<Contact>();
    //This is a string variable to hold the  Contact Record Type -  General recordTypeId
    String General = RecordHandler_GetRecordTypeId.getId(EnvironmentClass_RecordTypeNames.General, Schema.Sobjecttype.Contact.getName());
    if(trigger.isDelete) //If the DML action was a delete...
    {
        //... for every contact in the delete action...
        for(Contact c: trigger.old)
        {
            //... if the contact record type is the General...
            if(c.RecordTypeId == General)
            {
                //... then add the contact to our list of contacts.
                contacts.add(c);
            }
        }
    }
    else //This is an insert/update DML action.
    {
        //For every contact in the DML action...
        for(Contact c: trigger.new)
        {
            //... if the contact record type is the ES Contact Record Type - General...
            if(c.RecordTypeId == General)
            {
                //... then add the contact to our list of contacts.
                contacts.add(c);
            }
         }
    }  
}
4

0 回答 0