You need to sign in to do that
Don't have an account?
Cindy
Apex Trigger to Create Follow Up Task
I am new to apex and i am attempting to create an apex trigger that when a user enters a follow up date on the log a call action, create a task where the status is "not started" and the due date is the Follow up date on the call.
This is what i have so far and it is creating 2 tasks. What should i change to resolve this?
This is what i have so far and it is creating 2 tasks. What should i change to resolve this?
trigger CreateFollowUpTask on Task (after insert, after update) { Task[] oTasks = new List<Task>(); for (Task C : trigger.new ) { if (C.Follow_Up_Date_Time__c !=null){ oTasks new Task(Subject='Follow up', ActivityDate=C.Follow_Up_Date_Time__c,Status='Not Started',OwnerId=C.OwnerId,WhatId=C.WhatId,WhoId=C.WhoId)); } } insert oTasks; }
Please use below code:-
if you need any assistanse, Please let me know!!
Kindly mark my solution as the best answer if it helps you.
Thanks
Mukesh
Expression cannot be a statement.