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 

Help in SOQL Query

Hi,

I need a help in SOQL , 

Select id,subject,CreatedDate__c from task where whoid in (select leadId from CampaignMember where Campaign.id = '70128000000BAgd') and task.CreatedDate__c > (select startdate from campaign where id = '70128000000BAgd')

Iam trying retrieve the records with whoid in campaignmember and createddate of activity greater than camapaign StartDate but iam getting error .can some one advise what is the error here in this query.

Thanks
Kiran
Best Answer chosen by lokesh reddy 7
EldonEldon
Hi Lokesh,

Try the below code (replace the id with your id)
 
campaign camp= [select id,startdate from campaign where id = '701280000008s6q'];

task t= [Select id,subject,CreatedDate from task where whoid in 
    (select leadId from CampaignMember where Campaign.id = '701280000008s6q') 
    AND CreatedDate > :camp.startdate];
Let me know if you have any issues.

Mark it as best answer if it works.

Regards

All Answers

EldonEldon
Hi Lokesh,

Try the below code (replace the id with your id)
 
campaign camp= [select id,startdate from campaign where id = '701280000008s6q'];

task t= [Select id,subject,CreatedDate from task where whoid in 
    (select leadId from CampaignMember where Campaign.id = '701280000008s6q') 
    AND CreatedDate > :camp.startdate];
Let me know if you have any issues.

Mark it as best answer if it works.

Regards
This was selected as the best answer
lokesh reddy 7lokesh reddy 7
Thanks , it is working.