I tried to get all related tasks from the selected contact, but salesforce don't like my code. If I try to save I get the error: Invalid bind expression type of Task for column of type Id
What I'm doing wrong?
List<Taskrelation> RelatedTasks = [select taskId from taskrelation where relationid =: currentRecordId];
for (task rt : RelatedTasks) {
for(Task a: [select Id, Subject, CreatedDate, Createdby.Name, Owner.Name, RecordType.Name, Status, Who.Name, Who.Id, What.Name from Task where Id =:rt]) {
wrapperList.add(new Wrapper(a, 'task'));
}
}
TaskRelation
is a different object thanTask
-- you can't compare their Ids. Also you have aSELECT
statement inside the outer for loop so you are going to have problems with governor limits.