admin 管理员组

文章数量: 887021

trigger ClosedOpportunityTrigger on Opportunity (before insert, before update) {
    List<Task> listTask = 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;
            listTask.add(t);
        }
    }
    insert listTask;
}

 

本文标签: trigger Opportunity create Apex adds