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
randombardrandombard 

Reparent Activity History

Hi All,

 

trying to re-parent all activityhisory on a contact to a lead, I have this working for all open tasks and events but not for activity history.

 

I was hoping to use something as follows but its clearly not right.

 

{
//move Taskhistory
List<Task> TaskHistory = new List <Task>();
{For(Task TH:[select (SELECT id, WhoID from ActivityHistories) FROM CONTACT where ID = :C.Id])
    {
    TH.WhoID = L.Id;
    TaskHistory.add(TH);
    }
Update TaskHistory;
     System.debug('Success');
}
}

 

This is my first try at this after taks I want to move all historic events as well.

 

Any help greatly apreciated.

randombardrandombard

Sorry to bump but any help would be great.