12

I have a custom report saved with no filter criteria. When calling it, I populate the criteria through the URL, so that the final URL looks something like:

https://na7.salesforce.com/00OA000000xxxZG?pc0=00NA0000xxxku0A&pc1=00NA00000xxxIed
&pn0=eq&pn1=ge&pv0=55979&pv1=8%2F20%2F2012

This works fine and fills in up to 10 filter criteria. However, I don't seem to be able to use the bool_filter parameter to configure custom logic. From my understanding, the format should look like bool_filter=(1+OR+2)+AND+3. When this parameter is in the URL, I am directed to the Customize Report screen instead of displaying the report itself, and none of my criteria are reflected.

It seems possible to me that this might be a result of my report having no criteria in place initially, and maybe therefore "1 and 2" don't have any reference for bool_filter. Anyone have any experience with this?

  • I knew about pv0 etc, but not about pc0 and pn0. Awesome! Sorry I don't know about the bool_filter, though. – Benj Aug 20 '12 at 17:51
  • In some cases, the values to use for pc are the actual field Ids, as above. In older report types, they seem to be IDs unique to that report type. You can see them by Viewing Source on a report screen and looking for the picklist optgroups. – Jeremy Nottingham Aug 20 '12 at 18:13
  • Is it worth trying "%20" to URL encode the spaces rather than "+"? Ref Changing Salesforce report filters through url - change the Filter Logic too? and URL encoding the space character: + or %20? – Daniel Ballinger Aug 21 '12 at 1:47
  • I have actually tried it both ways, with + and with %20. Same result so far. Thanks for the links, I had looked at the Salesforce one before, which is what got me this far. – Jeremy Nottingham Aug 21 '12 at 2:00
9

I figured it out. The bool_filter parameter can only refer to criteria rows that are saved in the Report. My "template" report was saved with no criteria, so that I could add them one at a time. So when bool_filter refers to 1 AND (2 OR 3), those filter rows don't exist in the saved report, and it doesn't know what to do.

Solution for me: I saved the report with 10 filter rows, each of which is Created Date not equal ''. Then I change what fields and values those filter rows are pointing to, and make sure the bool_filter parameter includes all integers 1 through 10. The final URL looks like this: https://tapp0.salesforce.com/00OA0000004m4ZG?bool_filter=%28%281+AND+2%29+OR+%283+AND+4%29%29+AND+5+AND+6+AND+7+AND+8+AND+9+AND+10 &pc0=00NA0000009ku0A&pc1=00NA0000007jIed&pc2=00NA0000007jIed&pc3=00NA0000007jIed&pc4=00NA0000007jIed &pn0=eq&pn1=ge&pn2=le&pn3=ge&pn4=le &pv0=abc&pv1=8%2F21%2F2012&pv2=8%2F21%2F2012&pv3=8%2F21%2F2012&pv4=8%2F21%2F2012

0

If you have a report with 10 filter criteria, you need to include all 10 in your bool_filter statement.

bool_filter=(1+OR+2)+AND+3+AND+4+AND+5+AND+6+AND+7+AND+8+AND+9+AND+10

Or whatever logic you wish...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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