[SalesForce] URL hacking a report to pass a Date Literal filter value vs an actual date

Though not well documented by Salesforce, it's a well known fact that record pages and saved reports can be dynamically altered by passing URL parameters. For example, with a tabular report whose first filter is "Account Name", you can pass the filter value via a modified URL, like so:

/(reportSFID)?pv0=(Account Name)

to load the report on that specific account.

My question is in regard to filters on Date values. When I pass a specific date to a date filter value, eg '1/1/2014', it works fine. BUT, when I attempt to pass a date literal, eg 'LAST FISCAL QUARTER', it just takes me to the edit page of the report (which seems to indicate a failure with passing the value).

Has anyone had any experience passing date literal values using dynamic URLs?


EDIT: A little more messing around and I discovered a couple things:

  • Certain Date Literals CAN be passed – if they are multiple words you need to use underscores in the URL. For example,

/(reportSFID)?pv0=LAST_MONTH

  • Date literals that specify numerical ranges still don't seem to work, eg "LAST_6_MONTHS". Any insight on whether its possible to use these types of date literals is appreciated!

Best Answer

You can use SOQL date literals, such as LAST_N_MONTHS:6 or LAST_N_DAYS:90.

Related Topic