+ Start a Discussion
Alex Waddell 12Alex Waddell 12 

Exposing multiple Attachments in VF page

Hello everyone,

I am trying to expose multiple notes at the bottom of a VF Page where the notes are signatures. We have to capture 2 signatures everytime we complete an assessment on a patient. The first signature would be the patients and the second would be the care provider.

I have the signature component working, but now i need help setting up a apex class that will help me expose the attachments on another VF page.

The Notes and Attachments are under a custom object titled "Patient_ass__c"

We have a similar Class set up in our org that does this exact function but inside another object. Below is the Class for that object. If someone could help me edit this code to the Patient_ass__c object that would be awesome

public Class ContractDocumentExtension{
    public Contract__c contractDocument{get;set;}
    Public Attachment patientSign{get;set;}
    Public Attachment caseManagerSign{get;set;}
    public String chooserender{get;set;}
    Public List<contact> currContactLst;
    public ContractDocumentExtension(ApexPages.StandardController stdController){
        String parentid;         
        contractDocument= (Contract__c) stdController.getRecord();            
        if(contractDocument != Null){
            currContactLst = [SELECT ID FROM Contact WHERE Accountid  = : contractDocument.Patient__r.id];
        }        
        List<Attachment> attachmentLst = [SELECT ID,CreatedDate  FROM Attachment WHERE parentId =:contractDocument.id order by CreatedDate asc  ];        
        if(attachmentLst.size() == 1){
            patientSign = attachmentLst[0];            
        } 
        if(attachmentLst.size() == 2){
           patientSign = attachmentLst[0];
           caseManagerSign = attachmentLst[1];          
        }       
        if(ApexPages.currentPage().getParameters().get('renderAs') != null){
            chooserender = 'print';
        }else{
            chooserender = Null;    
        }