You need to sign in to do that
Don't have an account?

Soql query with today date in where clause
hi when iam writing simple query---
{select Next_Contact_Date__c , Contact_Name__r.name from engagement__c where Campaign__r.id=:cId AND Next_Contact_Date__c>=:system.today() ORDER BY Next_Contact_Date__c ASC}
It's working fine but due to some reasons i had to make it dynamic but after making it dynamic it's giving error i think may be of system.today()---
queryString = 'select Next_Contact_Date__c , Contact_Name__r.name from engagement__c where Campaign__r.id='+'\''+cId+'\'' + ' AND Next_Contact_Date__c>=:' + system.today() + ' ORDER BY Next_Contact_Date__c ASC';
please help i tried every thing from converting string to date format any everything
{select Next_Contact_Date__c , Contact_Name__r.name from engagement__c where Campaign__r.id=:cId AND Next_Contact_Date__c>=:system.today() ORDER BY Next_Contact_Date__c ASC}
It's working fine but due to some reasons i had to make it dynamic but after making it dynamic it's giving error i think may be of system.today()---
queryString = 'select Next_Contact_Date__c , Contact_Name__r.name from engagement__c where Campaign__r.id='+'\''+cId+'\'' + ' AND Next_Contact_Date__c>=:' + system.today() + ' ORDER BY Next_Contact_Date__c ASC';
please help i tried every thing from converting string to date format any everything
Try below code
IF it helps you than please mark it as a solution and ENJOY APEX
All Answers
In particular, take a look at using Next_Contact_Date__c >= TODAY
Try below code
IF it helps you than please mark it as a solution and ENJOY APEX
Please mark it as best solution to your problem if it does solve your problem.