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
SOUBHAGYA RANJAN DALAISOUBHAGYA RANJAN DALAI 

adding attachment to every record retrived

Hi ALL
i want to show 10 attachment under each contact record and when we check the particular contact record and click the button(process selected) then it will be downloaded in local system . i am giving my code of contact record . please help me ou to do this

VF PAGE

<apex:page controller="wrapperClassController">
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockButtons >
                <apex:commandButton value="Process Selected" action="{!processSelected}" rerender="table"/>
            </apex:pageBlockButtons>
            <apex:pageBlockTable value="{!contacts}" var="c" id="table">
                <apex:column >
                    <apex:inputCheckbox value="{!c.selected}"/>
                </apex:column>
                <apex:column value="{!c.con.Name}" />
                <apex:column value="{!c.con.Email}" />
                <apex:column value="{!c.con.Phone}" />
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>


CONTROLLER


public class wrapperClassController {

     
    public List<cContact> contactList {get; set;}

    
    public List<cContact> getContacts() {
        if(contactList == null) {
            contactList = new List<cContact>();
            for(Contact c: [select Id, Name, Email, Phone from Contact limit 10]) {
                
                contactList.add(new cContact(c));
            }
        }
        return contactList;
    }

    public PageReference processSelected() {

        List<Contact> selectedContacts = new List<Contact>();

        
        for(cContact cCon: getContacts()) {
            if(cCon.selected == true) {
                selectedContacts.add(cCon.con);
            }
        }

        System.debug('These are the selected Contacts...');
        for(Contact con: selectedContacts) {
            system.debug(con);
        }
        contactList=null; 
        return null;
    }


    
    public class cContact {
        public Contact con {get; set;}
        public Boolean selected {get; set;}
        public cContact(Contact c) {
            con = c;
            selected = false;
        }

    }
}
Harpreet On CloudHarpreet On Cloud
Hello SOUBHAGYA, if you can point out the actual problem that you are facing, it will be easier to provide solution to it.
SOUBHAGYA RANJAN DALAISOUBHAGYA RANJAN DALAI
in the above code i am getting the record with checkboxes .
i want some attachment under each record .
i want the code for that .