my objective is to pull a list of cases within Salesforce Service Cloud using SOQL that have happened within this year and are specifically email-to-case.

If I try this: SELECT CaseNumber, CreatedDate, ClosedDate FROM Case WHERE CreatedDate > 2020-01-01T00:00:00Z AND Origin = 'Email' it says "no records returned".

However, if I do

SELECT CaseNumber, CreatedDate, ClosedDate FROM Case WHERE (CreatedDate > 2020-01-01T00:00:00Z)

or

SELECT CaseNumber, CreatedDate, ClosedDate FROM Case WHERE Origin = 'Email'

it returns records. Can someone please let me know what I am doing wrong? Thanks!

5

Related questions 0 How to use CASE in WHERE dynamically ? With datetime selection 0 Using CASE with DATE Type in WHERE clause 1 Case statement in a where clause with dates Related questions 0 How to use CASE in WHERE dynamically ? With datetime selection 0 Using CASE with DATE Type in WHERE clause 1 Case statement in a where clause with dates 1 Using Case in a Where Clause for Dates 2 Unable to apply "where" clause to a date column in BigQuery 0 Case Statement in Where Clause for datediff 0 SQL Server : DATE or NULL Variable in WHERE clause 0 Using CASE When in Where clause with date parameters 0 CASE Expression within WHERE clause for different date fields 1 case on where statement with date Load 7 more related questions Show fewer related questions

Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.