When our users leverage the email-to-saleforce feature that allows them to bcc emails to salesforce, those emails are added as Tasks of type 'Email' in the Activity History related list for relevant Contacts, Accounts, Leads, and Opportunities.
I have a trigger that processes Tasks of type 'Email' based on the whatIds associated with the Task. Unfortunately, the whatIds for tasks coming from email-to-salesforce distro have a null whatId and whoId even though they show on the Activity History related list.
Has anyone run into this before? Can anyone recommend a fix?
EDIT
I'm working with Accounts. Here is a System.debug dump of the task object that is created and associated to the Account when email-to-salesforce is used. Note that the whoId and whatId are both null even though the Task shows up in the related list.
18:40:22:465 USER_DEBUG [24]|DEBUG|{null=Task:{LastModifiedDate=2015-05-29 22:40:22, CallDisposition=null, ActivityDate=2015-05-29 00:00:00, IsClosed=true, WhoCount=0, RecurrenceTimeZoneSidKey=null, RecurrenceInstance=null, RecurrenceType=null, IsHighPriority=false, CallType=null, Activity_Type__c=null, Tasking_Date__c=null, IsArchived=false, CallObject=null, RecurrenceEndDateOnly=null, RecurrenceMonthOfYear=null, AccountId=null, CreatedById=005i0000003Tu6yAAC, IsDeleted=false, Id=00T19000003AJPAEA4, CS_Contact_Date__c=null, RecurrenceStartDateOnly=null, RecurrenceDayOfMonth=null, Type=Email, OwnerId=005i0000003Tu5yABC, RecurrenceRegeneratedType=null, IsRecurrence=false, IsReminderSet=false, WhoId=null, SystemModstamp=2015-05-29 22:40:22, WhatCount=0, Description=Additional To: [email protected]