Contributor
EMODULOR1
Posts: 3
Re: Getting Object type of WhatId/WhoId Task/Event fields

oh thanks, i ended up doing what another user posted and it worked!

 

 

if(ta.WhatId != null){

String account_prefix = Schema.SObjectType.Account.getKeyPrefix();

String task_whatid = ta.WhatId;

System.debug('who: ' + ta.WhoId + ' what: ' + ta.WhatId + ' prefix: ' + account_prefix + ' eval: ' + task_whatid.startsWith(account_prefix) + ' id: ' + ta.id );

 

if(task_whatid.startsWith(account_prefix)){