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
Lakshmi SLakshmi S 

How append a date field to string filter in apex?

Requirement: I want to search Opportunity records based on closed date from the VF page. How to pass the date field to dynamic string query in apex?
I am getting below error.

Error:
unexpected token: '2021-03-01'

Please advise how to resolve this error.
sample code below:
---------------------------
if(closedDate != Null ){
                strFilter += 'AND Close_Date__c ='+closedDate;
  }
 
ANUTEJANUTEJ (Salesforce Developers) 
Hi Lakshmi,

>> https://developer.salesforce.com/forums/?id=906F00000008nAXIAY

as mentioned in the above example can you try 2021-03-01T00:00:00Z if this works?

 Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.  

Thanks.
mar linmar lin
TellTheBell Survey is a customer survey on the official portal of Taco Bell. TellTheBell Survey is launched to enhance the quality of these delicious dishes by getting reviews on the same. The Tellthebell Survey purely aims to meet customer requirements and expectations. https://tellthebell.ninja
Alexa staisyAlexa staisy
TellTheBell Survey is a customer survey on the official portal of Taco Bell. TellTheBell Survey is launched to enhance the quality of these delicious dishes by getting reviews on the same. The Tellthebell Survey purely aims to meet customer requirements and expectations. # translation services (https://www.talaat.me/) # tivo setup (https://tivosetup.com/)
nacy kellynacy kelly

Tellthebell (https://surveyforcustomers.com/tellthebell-com)
Taco Bell customer experience survey needs a valid taco bell receipt to enter in TellTheBell survey. As soon as they open www.tellthebell.com they will be asked to answer some questions to rate the customer feedback.

 
Jessica Pearson 26Jessica Pearson 26
Very great post. I just stumbled upon your blog and wished to mention that I have truly enjoyed surfing around your blog posts. I'm hoping you write again very soon! (https://infotainmentlab.com/health-insurance-if-you-smoke/)