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

Adding a Task(email type) to a record of a custom object
Hello,
Using Apex code, I want to add a task "send email" to a activity history for a custom object.
The fields i have in the email are
To
Subject
Body
Attachment
Parent Id
With the above value how can i add them to the activity history ?
Using Apex code, I want to add a task "send email" to a activity history for a custom object.
The fields i have in the email are
To
Subject
Body
Attachment
Parent Id
With the above value how can i add them to the activity history ?
insert new Task(Status = 'Completed', Type='Email', Whoid=con/leadId, WhatId = customobjectId);
All Answers
Just create with 'Completed' status.
Fill rest of the fields as well.
insert new Task(Status = 'Completed', Type='Email', Whoid=con/leadId, WhatId = customobjectId);