+ Start a Discussion

Associating New Task with Person Account and Opportunity

Need to create a new task upon creation of a new opportunity and associate the task with both the opportunity and a person account.  Attempting to put the person account Id in the WhoId of the new task but recieving the error FIELD_INTEGRITY_EXCEPTION, Contact/Lead ID: id value of incorrect type: 001L00000033TM9IAM: [WhoId]


What is the workaround for this?




List<Opportunity> opps =  [select Id, OwnerId, Person_Account__c from Opportunity where Id IN :trigger.new];
	for(Opportunity o: opps) {
Task newTask = new Task(OwnerId=o.OwnerId, Subject='Initial Call', Type ='Call',ActivityDate=Date.Today(), Status='Not Started', WhoId=o.Person_Account__c, WhatId=o.Id);