Take the 2-minute tour ×
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 Shrivastava Feb 20 '13 at 18:24
add comment

1 Answer 1

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
    
I got this working using Onclick Javascript from a detail button, and using XmlHttpRequest() object. The filtering is as @zachelrath suggests - it's a bit of a pain to get working but can be done. Used this site to URL encode the JSON, since this has to be done to pass as POST params. Also ensure the request header is in place: request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); –  Stephen B Nov 13 '13 at 4:12
    
I have similar problem in my project now, If you dont mind can you please share me the script so that i can use it as a reference. Thank you in advance! –  user4473 Nov 14 '13 at 16:03
    
@Santhosh gist.github.com/stephenbrown1/7443749 –  Stephen B Nov 15 '13 at 4:07
add comment

protected by Community Jan 23 at 5:59

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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