Default Task Type to Email when sending an email
by Rasmus Mencke on October 30, 2009 at 03:01 PM
One question I hear over and over again, is why is the task type when I am sending an email in Salesforce not defaulted to Email? This is becomes an issue when you want to do reporting on all your tasks and they are logged as your default task type which generally is "Call".
I have written an Apex Trigger you can use to overwrite the Task Type and set it to "Email" when you are sending out an email from Salesforce. The trigger will look for "Email:" in the subject and also look for "Additional to:" as the first part of the description.
trigger SetTaskType on Task (before insert) {
For (Task nc:Trigger.new) {
String subject = nc.Subject;
String description = nc.Description;
if ( subject != null && subject.startsWith('Email:') && description.startsWith('Additional To:')) {
nc.Type = 'Email';
}
}
}
TrackBack
TrackBack URL for this entry: http://www.typepad.com/services/trackback/6a00d8341cded353ef0120a69748f8970c
Listed below are links to weblogs that reference Default Task Type to Email when sending an email:

Comments
Posted by frasuy on December 3, 2009 04:35 PM:
Would an email created from the Outlook plug-in resulting in an activity history record fire this trigger?