Simple COQL datetime query not working

Simple COQL datetime query not working

I am trying to do a simple COQL query where I am comparing 2 datetime fields in a module and I keep getting the following error. Why does ZOHO make working with dates so difficult? I even tried running the following query against two datetime fields that are build into each module by ZOHO themselves and it still does not work.


  1. qryMap={"select_query":" select id from Deals where Modified_Time>Created_Time"}

  2. res= invokeurl
  3. [
  4. url :coqlEndpoint
  5. type :POST
  6. parameters:qryMap.toString()
  7. connection:"the connection"
  8. ];
This is what gets returned.
  1. {"code":"INVALID_QUERY","details":{"expected_data_type":"datetime","column_name":"Modified_Time"},"message":"value given seems to be invalid for the column","status":"error"}
If you replace the date with plain TEXT for example '2021-09-16T10:10:00+02:00' then it all works fine.

Any ideas?