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

working with condition based values

I am having several projects and each project conatins several task.

project task  need to be shown like in production,inventory respectively

If i click one project , that project task alone need to displayed  in corresponding production/inventory


others need not to be shown. in which way it can be accomplished.  how to work with condition based .



  If  a click link , id can be cached by jquery/javascript, then which way we can pass that in to apex page/controller 



Thiyagarajan SelvarajThiyagarajan Selvaraj



You can achieve this with the following code



public with sharing class projectList {

    // Here i assume two custom ojects Project__c and Task__c
    // Get project records
    public Project__c[] getProjects(){
        return [SELECT Id, Name FROM Project__c[]);
    // Get Task records related to the project
    public Task__c getTasks(){
        return [SELECT Id, Name FROM Task__c WHERE project__c=:ApexPages.currentPage().getParameters().get('id')];


<apex:page controller="projectList" >
    <apex:form >
      <apex:pageBlock >
          <apex:repeat value="{!Projects}" var="pro" >
              <apex:outputLink value="{!$Page.yourPage}?id={!pro.Id}" >{!pro.Name}</apex:outputLink><br />
      <apex:outputPanel layout="none" rendered="{!NOT(ISNULL($}" >
              <apex:repeat value="{!Tasks}" var="task" >
                  <apex:outputText value="{!task.Name}" /><br />