You need to sign in to do that
Don't have an account?
Irvine Delacroix
Using checkbox to Delete Multiple Records
Hi Experts,
I'd like your guidance on how to use checkbox in visualforce to delete multiple records.
Below is how my visualforce look like. I want to be able to select multiple attachments then click on the "Delete Selected" button to delete the records that are selected.
I'm stuck and I don't know how to achieve this.
I appreciate the help. Thanks much!
Here's my Code:
=====Page=====
<apex:page standardController="Contact" extensions="AttachmentController"> <apex:form > <apex:pageBlock Title="Notes and Attachments"> <!-- Buttons --> <apex:commandButton value="New Note"/> <apex:commandButton value="Attach File"/> <apex:commandButton value="Delete Selected"/> <apex:commandButton value="View All"/> <!-- Buttons --> <apex:pageBlockSection > <apex:pageBlockTable value="{!Attachments}" var="att"> <apex:column > <apex:inputCheckbox /> </apex:column> <apex:column value="{!att.id}"/> <apex:column value="{!att.name}"/> </apex:pageBlockTable> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
=====Class=====
public class AttachmentController { public AttachmentController(ApexPages.StandardController controller) {} string AttParentId = apexPages.currentPage().getParameters().get('id'); public List<Attachment> getAttachments(){ list<attachment> att = [select id, name, body from Attachment where parentId =:AttParentId ]; return att; } }
https://developer.salesforce.com/page/Wrapper_Class
Class Page Note:- code is not tested you may get come syntex error
All Answers
https://developer.salesforce.com/page/Wrapper_Class
Class Page Note:- code is not tested you may get come syntex error