function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
jjvdevjjvdev 

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?

 

Thanks

 

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);
		activities.add(newTask);
	}