I successfully achieved the report according to Asynchronous Reports with the Analytics API in Apex. I am using synchronous report and it work fine as code below :

global class

 public with sharing class ReportManager {

        public static Reports.ReportResults getReportResult(Id reportId){

           Reports.ReportResults result = Reports.ReportManager.runReport(reportId, true);

           return result;



controller class

public MyReport_Ctrl(){
    List<Report> lstReport=[Select Id ,Name from Report Where Name in ('My Active Contact')];

    for(Report r :lstReport ){
       Reports.ReportResults report = ReportManager.getReportResult(r.Id);

    myReport =mapReport.get('My Active Contact');


visualforce page snippet

               <thead >
                   <apex:repeat value="{!myReport.reportMetadata.detailColumns}" var="colName">
                       <th class="headerRow"><apex:outputText value="{!myReport.reportExtendedMetadata.detailColumnInfo[colName].label}"/></th>

                   <apex:repeat value="{!myReport.factMap['T!T'].rows}" var="row">
                       <tr class="dataRow">
                           <apex:repeat value="{!row.dataCells}" var="cell">
                               <td><apex:outputText value="{!cell.label}"/></td>

I noticed in actual report First Name, Account Name , Last Name is an hyperlink.How to retrieve the hyperlink and include in the report that I created in visualforce?

1 Answer 1


This is not an optimal solutions and wont work for every cell. Here, with "Won't work" I mean some columns may be erroneously shown as link. I have tweaked your code a little bit. In the <td> where you are actually showing the cells, I just put two tags. An outPutLink and an outPutText. And then using rendered attricute, I showed link to the cells where ID is present by some hack. You can get the hacks infor by looking at the IF statement in the rendered attribute. Here is the code:

    <apex:outputText value="{!cell.label}" rendered="{!IF(cell.label == cell.value || cell.value == null, true, false )}"/> 
    <apex:outputLink value="../{!cell.value}" rendered="{!IF(cell.label == cell.value, false, true)}">{!cell.label}</apex:outputLink>

Hope this helps!

You must log in to answer this question.

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