With the introduction of Joined Reports, Salesforce appears to have begun a fundamental shift in their Reports Runtime. Two of the major components of this shift, for Joined Reports, are:
- Report Metadata is passed around / defined as a JSON string called "runReportJson", "editReportJson", depending on whether you are Running a Report or Editing a Report, respectively.
- This metadata is expected to be sent through POST - passing in this value through GET / query string parameters does not affect a Joined Report's runtime.
So, in order to do what you're looking for, I believe you'll have to several things:
- Instead of sending users to a Report using a simple GET, you'll have to make a POST.
- You'll have to include the following POST variables / form data:
op: run
repId: <id of the report>
runReportJson: <a very complex, report-specific JSON string>
To modify parameters such as Dates, you'll have to change either the filters
or reportParams
attribute(s) of the runReportJson
object. You can figure out what your Joined Report's runReportJson
looks like by doing the following:
- Navigate to your Report in Salesforce.
- Open your browser's Developer Tools.
- Click "Run Report".
- From the Developer Tools, go to the 'Network' section, and click on the first entry in the left sidebar (called "Name" or "Path"). This entry should be the POST request to the Report servlet page, so it should be called
/<id of your report>
.
- Click on "Headers", then scroll down to "Form Data". You should see the above mentioned 3 POST Variables, looking something like this:
Notice the area I have highlighted in a red box --- this "filters" attribute of the runReportJson
object is what you'll need to modify to pass parameters into your report. Notice that this attribute is an Array of filter objects. Each filter object looks something like this:
{
"pc" : "<Filtered Field's Id, e.g. ACCOUNT_NAME>"
,
"pn" : "<filter operator, e.g. eq >"
,
"pv" : "<Filter Value you want to insert>"
}
There may be multiple of these "filters" attributes for each Block in your Joined Report, so you may need to pass values in to all of them through POST.
The "reportParams" attribute can also be modified to pass-in the higher-up Report parameters such as Date ranges. This usually comes right after the "filters" attribute in the JSON object.