+ Start a Discussion
karthic sankar 9karthic sankar 9 

how to launch a visualforce page from custom link in related list

HI Experts,

I have a related list page which is VF page. I manged to create hyperlinks in related list page like below.

upon clicking on the hyperlink i wanted to redirect to another visualForce page. Kindly help. Below is myContoller and VF page.

User-added image

VF page
<apex:page controller="ViewQAAMController">
<apex:form >
<apex:pageBlock >

<apex:pageBlockTable value="{!BadgeList}" var="data" align="center" styleClass="table table-striped" >
<apex:column headerValue="MyValues">
<apex:outputLink value="{!data['Week__c']}" onclick="openWindow()">{!data['Week__c']}</apex:outputLink>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
<script>
function openWindow(){
        window.location.href = https://connect--cpsdev7--c.cs60.visual.force.com/apex/AddQAAMWeeklyPlanner;
        }
    </script>
</apex:page>

Controller

public class ViewQAAMController {

    //public List<AggregateResult> BadgeList { get; set; }
   
    public List<AggregateResult> BadgeList
  {
      get
      {
          List<AggregateResult> badges = [select Week__c, max(createddate) apple from QAAM_Weekly_Planner__c Max group by Week__c order by max(createddate) desc LIMIT 10];
          return badges;
      }
      set;
  }
    
   }

KIndly help guys..


Thanks and Reagrds
Karthic Sankar V P

 
Best Answer chosen by karthic sankar 9
karthic sankar 9karthic sankar 9
Solved it using JavaScript

<apex:page controller="ViewQAAMController">
<apex:form >
<apex:pageBlock >

<apex:pageBlockTable value="{!BadgeList}" var="data" align="center">
    <apex:column value="{!data['Week__c']}"/>
</apex:pageBlockTable>

<apex:pageBlockTable value="{!BadgeList}" var="data" align="center" styleClass="table table-striped" >
<apex:column headerValue="MyValues">
<apex:outputLink value="{!data['Week__c']}" onclick="openWindow()">{!data['Week__c']}</apex:outputLink>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
<script>
function openWindow(){
         window.open('/apex/AddQAAMWeeklyPlanner');
        }
    </script>
</apex:page>