创建记录时,我正在尝试在自定义对象(Work_order__c)上制作记录副本。我认为这很接近,但我不确定我错过了什么。
这有效:
trigger CloneWorkorder on Work_Order__c (after insert) {
List<Work_order__c> CaLNewList = new List <Work_Order__c>();
for (Work_order__c WorkOrder : Trigger.new) {
if (workorder.CreateCopy__c) {
CaLNewList.add(new work_order__c(
case__c = workOrder.case__c));
}
}
insert CaLNewList;
}