admin 管理员组

文章数量: 887021

Create a Bulk Apex trigger

trigger ClosedOpportunityTrigger on Opportunity (after insert ,after update) {
    List<Task> lt= new List<Task>();
    for (Opportunity opp : Trigger.new){
        if(opp.StageName == 'Closed Won'){
            Task t = new Task();
            t.Subject='Follow Up Test Task';
            t.WhatId=opp.Id;
            lt.add(t);
        }
    }
    insert lt;
}

创建一个Task任务,将其与Opptunity 进行关联.

本文标签: 触发器 Apex