We are passing dynamic values to a report from a VF page and the URL is formatted differently. In classic, space is formatted with %20 whereas space if formatted with %2B and because of this a plus sign appearing in the filter value.

Example if there is a word Salesforce Developer, we are getting the value as Salesforce+Developer in lightning. Because of this we are not getting the values in reports.

I have the Sample Data for reference

URL https://abcd--sfidev.lightning.force.com/lightning/r/Report/00Om0000000H5pwEAC/view?fv0=Budget%2BSAIP&fv1=2019&fv2=Amino%2BAcids%2CFeed%2BQuality%2CAcidifers%2CMinerals%2CEubiotics%2COther%2BSpecialty%2CNNB%2CEnzymes%2CPremium%2BPre-Mix%2CPigments%2CAnimal%2BHealth%2CNavitas%2CVitamins&fv3=8005%2C8000%2C8014%2C8002%2C8007%2C8016%2C8006%2C8003%2C8004%2C8021%2C8019%2C8020%2C8011%2C8013%2C8018%2C8012%2C8022%2C8017&fv4=10237

I have tried passing value to dynamic report like the above example as explained by the user who answered my question. But I'm unable to find out why in classic for the space the valueis given as %20 and in lightning the value is given as %2B. Because of this the value is coming correctly in classic but in lightning a plus is placed between the two words such Salesforce+Developer.

here is the code I have been using

string userNames    = '';
        String prodPlatform = '';
        String profitCode   = '';
        String mgmtArea     = '';
        String region       = '';
        String subRegion    = '';

        for(integer i=0; i<selectedUser.size(); i++){
            userNames += EncodingUtil.URLENCODE(selectedUser[i],'UTF-8');
                userNames += ',';

        for(integer i=0; i<selectedProductPlatform.size(); i++){
           prodPlatform += EncodingUtil.URLENCODE(selectedProductPlatform[i],'UTF-8').replace('+','%20');

                prodPlatform += ',';

        for(integer i=0; i<selectedProfitCentre.size(); i++){
            profitCode += EncodingUtil.URLENCODE(selectedProfitCentre[i],'UTF-8');
                profitCode += ',';

        for(integer i=0; i<selectedMgmtAreaNames.size(); i++){
            mgmtArea += EncodingUtil.URLENCODE(selectedMgmtAreaNames[i],'UTF-8');
                mgmtArea += ',';

        for(integer i=0; i<selectedRegionNames.size(); i++){
            region += EncodingUtil.URLENCODE(selectedRegionNames[i],'UTF-8');
                region += ',';

        for(integer i=0; i<selectedSubRegionNames.size(); i++){
            subRegion += EncodingUtil.URLENCODE(selectedSubRegionNames[i],'UTF-8');
                subRegion += ',';

        String devName = ''; 

            devName = selectedCurrency =='USD' ? 'SFI_RevenueStreamSPUnallocated' : 'SFI_RevenueStreamSPUnallocated_E';
            devName = selectedCurrency =='USD' ? 'SFI_Revenue_Stream_Sales_Performance_Report' : 'SFI_RevenueStreamSalesPerformanceReportE';    

        List<Report> reportObj = [SELECT Id FROM Report WHERE DeveloperName = :devName];

        if(reportObj!=null && reportObj.size()>0){

            url +=(UserInfo.getUiThemeDisplayed() == 'Theme3') ? '/' + reportObj[0].Id : '/lightning/r/Report/'+reportObj[0].Id+'/view';
            url += (UserInfo.getUiThemeDisplayed() == 'Theme3') ?  '?pv0=' + selectedType  : '?fv0=' + selectedType;
            url += (UserInfo.getUiThemeDisplayed() == 'Theme3') ?   '&pv1=' + selectedFY : '&fv1=' + selectedFY;
            url += (UserInfo.getUiThemeDisplayed() == 'Theme3') ?  '&pv2=' + prodPlatform : '&fv2=' + prodPlatform;
            url += (UserInfo.getUiThemeDisplayed() == 'Theme3') ?  '&pv3=' + profitCode : '&fv3=' + profitCode;
            url += (UserInfo.getUiThemeDisplayed() == 'Theme3') ? (selectedUser.contains('') ? '&pv4=' + mgmtArea + '&pv5=' + region + '&pv6=' + subRegion : '&pv4=' + userNames ) :
            (selectedUser.contains('') ? '&fv4=' + mgmtArea + '&fv5=' + region + '&fv6=' + subRegion : '&fv4=' + userNames);

  • well what is the question? what do you need help with trying to resolve and what have you tried?
    – Ronnie
    Oct 14, 2018 at 14:45
  • Please include the code you are using to generate this URL.
    – David Reed
    Oct 14, 2018 at 19:36
  • @DavidReed I have added the code that I'm using to do this
    – Prasanth
    Oct 15, 2018 at 10:53
  • @Ronnie I have updated with what I have tried
    – Prasanth
    Oct 15, 2018 at 10:53

1 Answer 1


Have a look you can filter reports using URL parameters

Filter Reports via URL Parameters in Lightning Experience:-

Take note of the opportunities report URL.


Edit the URL to set the Type filter value to New Business by appending the parameter &fv0=New%20Business. The full, bookmarked URL reads:


Let's take a closer look at what the parameter means.

& — Denotes a new parameter in the URL. If no other parameters are present in the URL, then substitute ? in place of &.

=New%20Business — Specifies that the Type filter value is New Business

fv0 — The fv stands for "filter value," and is the name of the parameter. The 0 is the numerical order in which the filter appears in the report. (The first filter is 0, the second filter is 1, the third is 2, and so forth.) Standard filters don’t count in this order, and can’t be filtered using URL parameters, although they appear as the first three filters on any report. To set the value of the fifth filter in the report, specify fv4. In our example, we're filtering the first field filter in the report, the Type filter.

The parameter value must be URI encoded, which means certain characters (such as spaces) must be written in a format that URLs can understand. In our example, the space (' ') between "New" and "Business" becomes %20 when URI encoded.

Reference:- Filter Reports via URL Parameters in Lightning Experience

Also, I would like to draw your attention in recent changes in URL for lightning took place:-

So what’s the difference?
Example of new URLs
Original format: Account Home URL
New format: Account Home URL

Original format: Account Record View
New format: Account Record View

What will not be affected by this change?

Reports:- Filter Reports via URL Parameters in Lightning Experience will continue to work as it is supported by the Reports functionality. More details can be found in the Spring ’17 Release Notes.

Reference:- Here’s What You Need To Know About The New URL Format For Lightning

  • HI @Sanket Kumar, thank you for the explanation I have tried the same with what you have said. But in classic the space between two word is replaced by %20 and it is functioning as expected. But in lightning the space between two words is replaced by %2B and because of this a plus symbol is included between two words and that is why I'm not getting the values in report. My problem is to how to replace %2B to %20 in lightning.
    – Prasanth
    Oct 14, 2018 at 17:39
  • 1
    How you are passing the values? Have you created a custom link? or you open the report and then passing? It seems it is working for me perfectly irrespective of classic or lightning? Also, which browser you are using? Oct 14, 2018 at 17:51
  • Hi Sanket I have added the code I have been using. I'm passing values to report dynamically from apex.
    – Prasanth
    Oct 15, 2018 at 5:33
  • I'm passing the value from apex I'm not hardcoding %20 or %2B
    – Prasanth
    Oct 15, 2018 at 10:52
  • @Prasanth - releasenotes.docs.salesforce.com/en-us/spring17/release-notes/… This builds on his answer here - might be useful if this is in any way related to how you're using the lightning Reporting and your URL redirect in your apex. Documentation shows it should be a %20 in accordance to this doc - but it looks like your encoding is pushing this like you're coding for an HTTP Query to place the "+" in it
    – Ronnie
    Oct 16, 2018 at 2:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .