You need to sign in to do that
Don't have an account?
Abhinav Gupta
Does convertTimezone function ever works ?
I tried calling this function from both APEX and WS API, with a simplest soql fragement mentioned in salesforce docs itself i.e.
SELECT convertTimezone(CreatedDate) FROM Opportunity
I always got this error : MALFORMED_QUERY: Invalid aggregate function: convertTimezone How does this guy works ?
I also posted this in general development discussion boards, but no reply till yet, so posting here also. Simon, you there :) ?
Per the documentation, you have to use convertTimezone within a date function. Here's an example that works (in the documentation):
This finds the sum of all opportunities, grouped by the hour of the day, with a translation accounting for the user's current time zone. They also explicitly mention that this query will not work:
It doesn't work because there is no date function being applied to the query.
The list of date functions that are available are listed here: SOQL Date functions
All Answers
Per the documentation, you have to use convertTimezone within a date function. Here's an example that works (in the documentation):
This finds the sum of all opportunities, grouped by the hour of the day, with a translation accounting for the user's current time zone. They also explicitly mention that this query will not work:
It doesn't work because there is no date function being applied to the query.
The list of date functions that are available are listed here: SOQL Date functions
Thanks SfdcFox, I was in super hurry that day, so just copied the SOQLs and started playing to wrap up the pending.