3 个回答
Hi,Can you please try the below code:
Kindly let me know if it helps you and close your query by marking it as best answer so that it can help others in the future.Warm Regards,Shirisha Pathuritrigger Agentenddatetrigger on Agent__c (after insert)
{
List<Task> taskList = new List<Task>();
for(Agent__c age : Trigger.new){
if(age.End_Date__c< Date.Today()){
Task newTask = new Task(whatID = age.ID, Subject='Follow Up Test Task');
//A task is created with Opportunity ID and with the subject.
taskList.add(newTask);
}
}
if(taskList.size()>0){
insert tasklist;
}
}