function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
HSinghalHSinghal 

Download Multiple Reports using custom URLs at one go with a user-specified name

Hi All

 

I am trying to download multiple reports in PRINTABLE VIEW with user-specified names(like , "MyReport.xls" and not with default random name given by SFDC such as "report000023232.xls" ) with the help of custom URLs.

 

I am able to download a single report at a time using the following custom URL:

"https://ap1.salesforce.com/00ON0000000YJKB?excel=1&details=no"

 

 

But now I want to hit multiple such URLs on a single click, but unable to do so.

 

My current code is as follows:

 

VF Page code:

 

 

<apex:page controller="exportReport"  contentType="application/vnd.ms-excel#{!$Request.fileName}"  showHeader="false" showChat="false"  >

<apex:outputText escape="false" value="{!reportData}"/>
</apex:page>

 


APEX Custom Controller:

 

public with sharing class exportReport {
    public String getReportData() {

        
        Id reportId='00ON0000000YJKB';
        if(reportId != null && reportId.getSobjectType() == Report.SobjectType) {
            PageReference ref = new PageReference('/'+reportId+'?pv1=FIS-UK&excel=1');
            System.debug(logginglevel.error,ref.geturl());
            return ref.getContent().toString();
        }        
        return null;
    }
}

 

The underlined code represents the renaming attribute used and the custom link called on VF Pageload respectively.

 

Now I want multiple reports to be downloaded with a single button click using these custom links and simultaneously specifying new report names using "content type" attribute as done above.

 

Urgent HELP REQD.....

 

Thanks in advance!!

HSinghal