0

I have a report in salesforce named Yesterday's Transactions(Type:Opportunities with Transaction). I have two fields i.e. Transaction Id and Created Date.

My report contains today's date even though I filter it on Created Date = YESTERDAY.

What could be the reason behind this inconsistency? I tried to search about it on the forum but did not find satisfying answer. Thank you

  • Are you seeing records created yesterday's in today's report by the same user as the one who is running the report? – Rao Sep 28 '17 at 18:02
  • Which CreatedDate do you want, the opportunity or the transaction? Make sure the created date field in your filter is from the same object as the one you are displaying. – David Cheng Sep 28 '17 at 19:24
  • @DavidCheng, Yes I am using CreatedDate from the Transaction object. Still I can see the today's records in yesterday's report. – Subhash Deshmukh Sep 29 '17 at 17:47
1

Why is the question marked as android-related? If you're using some dedicated integration account to connect, this "user's" timezone might impact what "yesterday" means, at what time his 12 am (midnight) starts compared to your timezone.

Out of the box reports don't show you hours part in "CreatedDate" but compare what you see with a query, maybe try sorting the results, experiment a bit?

SELECT Name, CreatedDate, Opportunity__r.Name
FROM Transaction__c
WHERE CreatedDate = YESTERDAY
ORDER BY CreatedDate
  • I have removed the android-related tag. I think the difference I am getting between the salesforce report and soql query result set is because of the time zone difference. ie. My salesforce account timezone is set to EST. So, it will filter out the results in report based on EST dates. On the other hand SOQL returns the results in UTC timezone. Let me know if I am correct? – Subhash Deshmukh Nov 20 '17 at 13:51
  • Yep, that's my understanding too. Reports (and other SF UI in general) silently adjust for user's timezone. But SOQL always returns UTC. See developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/…. If you want - SOQL has built-in function for conversion to running user's preferred timezone: developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/… – eyescream Nov 20 '17 at 21:31
  • I have looked into the link: developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/… that you have shared regarding the conversion of timrzone. But, it looks like it only works if we use date function in the SOQL query. For normal query like "SELECT Id,CreatedDate FROM Opportunity WHERE CreatedDate > 2017-11-01T00:00:00Z" it will not work. – Subhash Deshmukh Nov 24 '17 at 8:17
  • The filter you're using already is supposed to be in UTC, that's what "T" and "Z" mean. stackoverflow.com/questions/30209941/what-t-and-z-means-in-date. So yes, for filter part - you need to cast your app's time down to UTC ( I expect your programming language will have a native function for it) & format it as as the "...T...Z" because that's what SOQL expects.. For reading results back - either you reverse the process on all date fields or you wrap them in convertTimezone() – eyescream Nov 24 '17 at 9:01
  • I have one more query regarding this. Does SOQL also convert the timezone of Date field('2017-10-11') not datetime from salesforce to UTC? Because when using only date field in the soql filter we don't use "..T...Z". am I correct? – Subhash Deshmukh Nov 27 '17 at 16:51

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.