"The SOQL query does not appear valid" warning when using `N_MONTHS_AGO`

Issue #2135 resolved
Jason Clark created an issue

In the SOQL Query tab, this query:

SELECT COUNT() 
  FROM EmailMessage
 WHERE CreatedDate = N_MONTHS_AGO:5

Produces a warning popup, every time you execute the query.

The SOQL query does not appear valid. Would you still like to execute it?

N_MONTHS_AGO appears without formatting, and with an error marker in front. Clicking “Yes” does run the query successfully.

Changing N_MONTHS_AGO:5 to LAST_N_MONTHS:5 prevents the error. I’m guessing some of the Date Literals aren’t in the symbol table. The full list is available here: https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_dateformats.htm

Comments (4)

  1. Scott Wells repo owner

    Thanks, Jason. Looks like an omission in the Apex/SOQL parser. I'm in the process of getting the Summer '22 release out now but will address this (and any similar omissions) for the release later this week.

  2. Log in to comment