You need to sign in to do that
Don't have an account?
Chad.Pfrommer
Class using "THIS_FISCAL_YEAR" not compiling in one particular org.
Salesforce provides date literals you can use in your SOQL queries. Here's their documentation - see page 20:
https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_sobject_create.htm
When I run:
Anyone else ever experienced this?
There is an apex class in production that is using that query - and it's currently running fine. Unfortunately, when we try to push changesets to prod and run all our unit tests, we get compilation errors on that class. Our current workaround is to select specific unit tests to run when deploying to prod, however this solution is far less than ideal, and won't help if we need to make changes to that class.
https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_sobject_create.htm
When I run:
SELECT Id FROM Opportunity WHERE CloseDate = THIS_FISCAL_YEARthrough Dev console in my prod org, I get an invalid date error. When I run queries in the same org using other date literals, like the example queries from the docs, they work fine. That query executed in a partial sandbox doesn't work either. That query executed in my own developer org works fine.
Anyone else ever experienced this?
There is an apex class in production that is using that query - and it's currently running fine. Unfortunately, when we try to push changesets to prod and run all our unit tests, we get compilation errors on that class. Our current workaround is to select specific unit tests to run when deploying to prod, however this solution is far less than ideal, and won't help if we need to make changes to that class.
All Answers
I have being stuck in same error earlier. In Apex class we need to use reference ":" try adding this after "=" and before date literal.
Hope this helps!!!
Thanks,
Gaurav
Skype:gaurav62990
Takes Freelance Job
This line works perfectly in my org:
Try luck with above code.
Thanks,
Gaurav
There must be some Org specific setting that is causing this issue.