Tell me more ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

Is it possible to pass variables to Joined Reports (as in pv0=) and/or is it possible to set the Time Frame selector for each report in a Joined Report?

The problem I am trying to solve is having one Joined Report (with 4 blocks) serve to provide multiple time ranges (last qtd, last year, current ytd, etc.) I want to avoid creating 4 copies of the same joined report with only the time range differing.

share|improve this question
i deleted the answer as you are right .tried with joint and no luck – Mohith Kumar Feb 20 at 18:24

1 Answer

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:

  1. 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.
  2. 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:

  1. Instead of sending users to a Report using a simple GET, you'll have to make a POST.
  2. 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:

  1. Navigate to your Report in Salesforce.
  2. Open your browser's Developer Tools.
  3. Click "Run Report".
  4. 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>.
  5. Click on "Headers", then scroll down to "Form Data". You should see the above mentioned 3 POST Variables, looking something like this:

enter image description here

  1. 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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.