URL Hacking Cross Filter Reports

Warning: The Following Post is a Completely Unsupported Hack. Salesforce may make changes at any time that makes this not work.

You probably know how to pass report parameters using the url. This is helpful when you want to create links from a record in Salesforce to a related report. Cross filter reports can also be passed parameters, but it is a little more difficult to do than with a standard filter.

The first thing I did is create a report that uses a cross filter. In this example, we’ll look for accounts that have an opportunity with a close date after a certain date.

cross filter report

I then looked at the page source and found the relevant hidden fields we need to work with.

cross filter source

As you can see there are a lot of fields that need to be provided. Unfortunately you can’t set up the cross filter and just pass in the values like you can with standard filters. You need to pass in all filters and save the report without a cross filter.

Let’s examine each one to try and figure out what they mean.

ptable0 – This parameter corresponds to the main object in your report. I haven’t quite figured out what goes here, but it seems to be CUST_ID for custom objects and [OBJECT NAME]_ID for standard objects.

ocond0 – Use w for with and wo for without

rtable0 – This is the cross filtered object. It should be the object name for standard objects and the object ID for custom ones.

rtablecol0 – This is the column on the cross filtered object that corresponds to the parent object.  For standard objects, use the field name and and for custom objects, use the field ID.

sfpc0_0 – This is the field to filter on. For standard objects, use the field name and and for custom objects, use the field ID.

sfpn0_0 – This is the filter operator. It can be values such as eq, ne, gt, lt, ge, le.

sfpv0_0 – This is the value you want to filter on.

cross filter report and fields

 

Now that we have a better idea of what each one does, we can use them in a URL. So in this example, our URL will look like this

/[ReportID]?ptable0=ACCOUNT_ID&ocond0=w&rtable0=Opportunity&rtablecol0=Account&sfpc0_0=CloseDate&sfpn0_0=ge&sfpv0_0=1/1/2014

We can just change the date at the end to get it to populate a different date. Just save your report without any cross filters and then use the URL parameters to filter accordingly.

I’ve found that the best way to figure out all the parameters is to first create a report with the filter, run it and then view the page source. Just search for the list of hidden fields and look for the values that you should pass.

Good luck with your URL hacking!