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
lokesh reddy 7lokesh reddy 7 

Need help in one Scenario

There is a campaign c1 under that campaign there are 4 campaign members 
Campaign Member 1 - Lead1 - There are 3 activities under this lead 
Campaign Member 2 - Lead2 - There are 2 activities under this lead
Campaign Member 3 - Contact1 - There are 3 activities under this contact
Campaign Member 4 - Contact 2 - There are 2 activities under this lead

With this data iam pushing into one custom object :
That object will contains campaign name ,lead id,contact id,subject,activity id,activity created date

Out of 3 activities from Lead L1 i need to display only one activity which satisfies the below condition

List<Task> = [select id,subject,createddate from task where whoid in (select leadid from campaignmember )  and task.createddate > camp.start date] 

How to achieve this for all the campaigns .please adivse