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
Chris Simmons 3Chris Simmons 3 

Visualforce Page w/ Report Components that Open in New Window

My end goal is to add a Visualforce Page to the Home Page that will (a) have three Report Components, (b) redirect the user to the Report in a new window when they click on one of the Report Components (as opposed to the default functionality where the Report will open within the frame), & (c) have 3 columns for the 3 Report Components.

I don't have any development experience, but was able to cobble together the snippet below...

<!-- Begin Default Content REMOVE THIS -->
  <apex:page >
       <apex:pageBlock >
           <apex:pageBlockSection columns="3">
           
<!-- My Leads/Contacts that are SQLs Report -->  
           <!-- Ensure that when the user clicks on the chart, it redirects to a new window as opposed to default functionality to open up within the Visualforce frame -->        
                <script type="text/javascript">
                      function Test(){
                      var url = 'https://ap1.salesforce.com/00OQ0000000PxZd';
                      window.parent.location.replace(url);
                 }
                 </script>
                 <apex:outputLink onclick="Test();">
                 <analytics:reportChart reportId="00OQ0000000PxZd"></analytics:reportChart>
                 </apex:outputLink>
                 
<!-- My Activities Due Today Report --> 
           <!-- Ensure that when the user clicks on the chart, it redirects to a new window as opposed to default functionality to open up within the Visualforce frame -->
                <script type="text/javascript">
                      function Test(){
                      var url = 'https://ap1.salesforce.com/00OQ0000000Q2KU';
                      window.parent.location.replace(url);
                 }
                 </script>
                 <apex:outputLink onclick="Test();">
                 <analytics:reportChart reportId="00OQ0000000Q2KU"></analytics:reportChart>
                 </apex:outputLink>  
                 
<!-- My Open Opps for this Fiscal Quarter Report -->  
            <!-- Ensure that when the user clicks on the chart, it redirects to a new window as opposed to default functionality to open up within the Visualforce frame -->
                <script type="text/javascript">
                      function Test(){
                      var url = 'https://ap1.salesforce.com/00OQ0000000Q2KZ';
                      window.parent.location.replace(url);
                 }
                 </script>
                 <apex:outputLink onclick="Test();">
                 <analytics:reportChart reportId="00OQ0000000Q2KZ"></analytics:reportChart>
                 </apex:outputLink>
                 
          </apex:pageBlockSection>
       </apex:pageBlock>
  </apex:page>
  <!-- End Default Content REMOVE THIS -->

The snippet displays the Report Component in three columns (good), but the columns are staggered (bad). When I click on the Report Components, it tries to redirect me to a new window (good), but the new window is just a salesforce login page (not sure if that's good or bad).

I was hoping y'all could take a look at the code & offer suggestions on how I can get the Report Components in a straight line & let me know if the existing code will open the Report Components in a new window.

User-added image