Skip to main content

How to display Account' visualfroceAccount visualforce page on Case'Case layout?

I want to display on my case layout other open casesCases related to accAccount from case. I have got a VFP to display them on my Account page layout but I can't display them on my Case layout. Any ideas what to do? I could get those records without VF with trigger on my Cases but i try to find different way to do that.

VFP code:

<apex:page standardController="Account" extensions="contrller">

  <apex:form >
    <apex:pageblock >
       <apex:pageBlockTable value="{!relatedCases}" var="val">
         <apex:facet name="header"><b>Open Customer Service Cases</b></apex:facet>       
         <apex:column value="{!val.CaseNumber}"/>         
         <apex:column value="{!val.Status}"/>
         <apex:column value="{!val.RecordTypeId}"/>
         
       </apex:pageBlockTable> 
    </apex:pageblock>
  </apex:form>
</apex:page>

with controller:

public with sharing class contrller {
Public id Current_Acc_Id;

    public contrller(ApexPages.StandardController controller) {
    Current_Acc_Id = controller.getRecord().id;
    }

    public List<Case> getrelatedCases(){
        List <case> conList = New List<Case>();
        for(Account acc:[select (select status, CaseNumber, RecordTypeId from cases WHERE RecordTypeId = '01220000000QawC' AND Status != 'Closed') from account where id=:Current_Acc_Id]){
           for(case con:acc.cases)
               conList.add(con); 
        }
        return conList;
    }
}

How to display Account' visualfroce page on Case' layout?

I want to display on my case layout other open cases related to acc from case. I have got a VFP to display them on my Account page layout but I can't display them on my Case layout. Any ideas what to do? I could get those records without VF with trigger on my Cases but i try to find different way to do that.

VFP code:

<apex:page standardController="Account" extensions="contrller">

  <apex:form >
    <apex:pageblock >
       <apex:pageBlockTable value="{!relatedCases}" var="val">
         <apex:facet name="header"><b>Open Customer Service Cases</b></apex:facet>       
         <apex:column value="{!val.CaseNumber}"/>         
         <apex:column value="{!val.Status}"/>
         <apex:column value="{!val.RecordTypeId}"/>
         
       </apex:pageBlockTable> 
    </apex:pageblock>
  </apex:form>
</apex:page>

with controller:

public with sharing class contrller {
Public id Current_Acc_Id;

    public contrller(ApexPages.StandardController controller) {
    Current_Acc_Id = controller.getRecord().id;
    }

    public List<Case> getrelatedCases(){
        List <case> conList = New List<Case>();
        for(Account acc:[select (select status, CaseNumber, RecordTypeId from cases WHERE RecordTypeId = '01220000000QawC' AND Status != 'Closed') from account where id=:Current_Acc_Id]){
           for(case con:acc.cases)
               conList.add(con); 
        }
        return conList;
    }
}

How to display Account visualforce page on Case layout?

I want to display on my case layout other open Cases related to Account from case. I have got a VFP to display them on my Account page layout but I can't display them on my Case layout. Any ideas what to do? I could get those records without VF with trigger on my Cases but i try to find different way to do that.

VFP code:

<apex:page standardController="Account" extensions="contrller">

  <apex:form >
    <apex:pageblock >
       <apex:pageBlockTable value="{!relatedCases}" var="val">
         <apex:facet name="header"><b>Open Customer Service Cases</b></apex:facet>       
         <apex:column value="{!val.CaseNumber}"/>         
         <apex:column value="{!val.Status}"/>
         <apex:column value="{!val.RecordTypeId}"/>
         
       </apex:pageBlockTable> 
    </apex:pageblock>
  </apex:form>
</apex:page>

with controller:

public with sharing class contrller {
Public id Current_Acc_Id;

    public contrller(ApexPages.StandardController controller) {
    Current_Acc_Id = controller.getRecord().id;
    }

    public List<Case> getrelatedCases(){
        List <case> conList = New List<Case>();
        for(Account acc:[select (select status, CaseNumber, RecordTypeId from cases WHERE RecordTypeId = '01220000000QawC' AND Status != 'Closed') from account where id=:Current_Acc_Id]){
           for(case con:acc.cases)
               conList.add(con); 
        }
        return conList;
    }
}
Source Link

How to display Account' visualfroce page on Case' layout?

I want to display on my case layout other open cases related to acc from case. I have got a VFP to display them on my Account page layout but I can't display them on my Case layout. Any ideas what to do? I could get those records without VF with trigger on my Cases but i try to find different way to do that.

VFP code:

<apex:page standardController="Account" extensions="contrller">

  <apex:form >
    <apex:pageblock >
       <apex:pageBlockTable value="{!relatedCases}" var="val">
         <apex:facet name="header"><b>Open Customer Service Cases</b></apex:facet>       
         <apex:column value="{!val.CaseNumber}"/>         
         <apex:column value="{!val.Status}"/>
         <apex:column value="{!val.RecordTypeId}"/>
         
       </apex:pageBlockTable> 
    </apex:pageblock>
  </apex:form>
</apex:page>

with controller:

public with sharing class contrller {
Public id Current_Acc_Id;

    public contrller(ApexPages.StandardController controller) {
    Current_Acc_Id = controller.getRecord().id;
    }

    public List<Case> getrelatedCases(){
        List <case> conList = New List<Case>();
        for(Account acc:[select (select status, CaseNumber, RecordTypeId from cases WHERE RecordTypeId = '01220000000QawC' AND Status != 'Closed') from account where id=:Current_Acc_Id]){
           for(case con:acc.cases)
               conList.add(con); 
        }
        return conList;
    }
}