Friday, July 8, 2011

Date Literals

Today, while debugging an orchestration, I came across a soql that contained this in where clause "LAST_N_DAYS:1".  I had not seen it before and searched the orchestration for where the variable was declared and found nothing.  I thought it might be something specific to CastIron but after a quick google search, it turned up in the salesforce documentation:

http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_soql_select_dateformats.htm

So, if you needed to find all of the opportunities that were updated in the last 10 days, you could write something like this: select o.Id from Opportunity o where o.LastModifiedDate >= LAST_N_DAYS:10

And the documentation has a bunch of other Date Literals that should be very handy!

No comments:

Post a Comment