You need to sign in to do that
Don't have an account?

Create Log a Call with Apex
Hi,
I created an apex class that creates a task. Im wondering how I can change that to 'Log a Call'. The reason I want to do this is because in our feed view in cases there is a 'Log a Call' section and a 'Task and Activity' section. I want to populate the Log section rather than the Task section.
Thanks,
-Julio Hernandez
I created an apex class that creates a task. Im wondering how I can change that to 'Log a Call'. The reason I want to do this is because in our feed view in cases there is a 'Log a Call' section and a 'Task and Activity' section. I want to populate the Log section rather than the Task section.
Thanks,
-Julio Hernandez
I tried the below code to create a call log using apex trigger and it seems to be working.The call gets logged under the activity log as a call after the contact is created.
Please check the fields I have selected to make the task register as a call, list of Task fields given here: https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_task.htm
Code:
trigger logcall on Contact (after insert) {
//create a task for the new contact
//Task newTask = new Task(Subject='Complete Survey for Transaction');
Task newTask = new Task(Description = 'Survey Transaction',
Priority = 'Normal',
Status = 'Completed',
CallDisposition = 'Call back',
Subject = 'Call', // setting this makes this task registered as a call
CallType = 'Outbound',
IsReminderSet = true,
ReminderDateTime = System.now()+1,
WhoId = trigger.new[0].Id );
insert newTask;
}
CallObject //should be unique
CallType
Type='Call' // should be of type Call
Not sure but usuallty
Status = 'Completed' // in call logs
Try following code from anynomous block