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
shillshill 

Query Error In the API

Hello,
 
I am trying to run a query via the API, but I am running into an error - I was hoping someone could help me out.    I am trying to query for lead records with the following query:
 
Select AnnualRevenue, City, Company, Country, Email, HasOptedOutOfEmail, Fax, FirstName, Name, Id, LeadSource, MobilePhone, Phone, Rating, Salutation, State, Status, Street, Title, Website, PostalCode, Owner.Name From Lead where LastActivityDate>=2008-03-04T22:02:00Z AND Email like  '%@%' AND IsConverted=false
 
I get the following error back from the API:
INVALID_FIELD:  PostalCode,Owner.Name From Lead where LastActivityDate>=2008-03-04T22:02:00Z                                       ^ ERROR at Row:1:Column:209 value of filter criterion for field 'LastActivityDate' must be of type date and should not be enclosed in quotes.
 
I was wondering why I'm getting this error, since the filter value I have for LastActivityDate is not enclosed in quotes in my query.
 
I can run the exact same query, replacing LastActivityDate with LastModifiedDate, with no problem at all:
 
Select AnnualRevenue, City, Company, Country, Email, HasOptedOutOfEmail, Fax, FirstName, Name, Id, LeadSource, MobilePhone, Phone, Rating, Salutation, State, Status, Street, Title, Website, PostalCode, Owner.Name From Lead where LastModifiedDate>=2008-03-04T22:02:00Z AND Email like  '%@%' AND IsConverted=false
 
Thank you,
Scott

 
 
SuperfellSuperfell
LastActivityDate is a date, not a date filter, your filter value should be a date (e.g. 2008-03-08)
shillshill
That's what I was missing, thank you!
 
(I'm still working on the other thread of the "not like" filter, and will reply to that one with my progress)
 
Scott