1

In sales cloud, if I am running the same SOQL query with a "WHERE systemmodstamp > X" against the REST API under the context of two different users, one user is set to GMT, another pacific time, would I always get the same exact result set?

In other words, does the user timezone setting affect querying via SOQL via the REST API, or will it always return datasets based off UTC and ignore the user's timezone setting?

1
  • Data is always returned in user context.
    – Himanshu
    Jan 29 '16 at 16:32
3

When performing a query, you can specify any time zone you want in the query by being explicit:

SELECT Id FROM Lead WHERE SystemModStamp > 2016-01-29T00:00:00.000-07:00

You have to specify a time zone, with most developers preferring to use Z (UTC+00:00). For example, the data loader uses these values by default. You can't use the user's time zone implicitly in a query.

The exception to this rule are the "Date Literals", which allow you to specify values in the context of the current user:

SELECT Id FROM Lead WHERE SystemModStamp = TODAY

This will return all leads modified today, according to the user's time zone settings. Two users in different time zones may very well get different results depending on their time zone settings.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.