You need to sign in to do that
Don't have an account?

Creating a Custom pick list
when user select an account from the picklist, all opportunities which are related to that account should be displayed in a table with checkbox in a first column of each row, there should be one master checkbox in the header of the table to select or deselect all opportunities in one click.
Refer this link:
https://salesforce.stackexchange.com/questions/94058/master-check-box-to-select-all-records
https://salesforce.stackexchange.com/questions/93263/how-to-get-related-opportunities-of-a-account-by-select-list
https://stackoverflow.com/questions/14823107/how-to-find-out-which-checkboxes-have-been-selected-on-the-next-page-in-visualfo
Hope this helps.
Thanks,
Jenefa
Sweet Potato Tec
try this code
<apex:page controller="accountfiltercon">
<apex:form >
<apex:pageBlock title="Accounts">
<h5>
Account Name</h5>
<apex:selectList size="1" value="{!selectedname}">
<apex:selectOptions value="{!selectedaccnamefields}"/>
<apex:actionSupport event="onchange" action="{!showOpps}" reRender="ListOpp">
<apex:param value="{!selectedname}" assignTo="{!AccName}" />
</apex:actionSupport>
</apex:selectList>
</apex:pageBlock>
<div class="slds-m-top_xx-large"></div>
<apex:outputPanel id="ListOpp" >
<apex:pageMessages id="showmsg"></apex:pageMessages>
<apex:pageBlock title="Account's opportunity" rendered="{!showHide}">
<apex:pageBlockTable value="{!wrapperAccList}" var="opp">
<apex:column >
<apex:facet name="header">
<apex:inputCheckbox id="mainBox" value="{!mainBoxValue}" >
<apex:actionSupport event="onclick" action="{!checkUncheckAll}" reRender="ListOpp"/>
</apex:inputCheckbox>
</apex:facet>
<apex:inputCheckbox value="{!opp.flag}"/>
</apex:column>
<apex:column headerValue="Name" value="{!opp.oppObj.Name}"/>
<apex:column headerValue="Stage" value="{!opp.oppObj.StageName}"/>
<apex:column headerValue="Close Date" value="{!opp.oppObj.closeDate}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:outputPanel>
</apex:form>
</apex:page>
public class accountfiltercon {
Public string selectedname{get;set;}
Public String AccName {get;set;}
Public List<Opportunity> oppList {get;set;}
public boolean showHide {get;set;}
public List<checkBoxWrapper> wrapperAccList{get;set;}
public Boolean mainBoxValue {get;set;}
Public List<Selectoption> getselectedaccnamefields(){
List<Selectoption> lstnamesel = new List<selectoption>();
lstnamesel.add(new selectOption('', '- None -'));
for(Account acc :[SELECT id,name,phone,type,industry FROM Account]){
lstnamesel.add(new selectoption(acc.id,acc.name));
}
return lstnamesel;
}
public void showOpps(){
System.debug('selectedname-->'+selectedname);
if(selectedname!=null && (selectedname.length()==15 || selectedname.length()==18)){
wrapperAccList = new List<checkBoxWrapper>();
for(Opportunity opp :[select Name,StageName,CloseDate from Opportunity where AccountId=:selectedname]){
wrapperAccList.add(new CheckBoxWrapper(false,opp));
}
if(wrapperAccList.size() > 0){
showHide =true;
}else{
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.FATAL,'This Account Opportunity Not avalaible'));
}
System.debug('oppList-->'+oppList);
}
}
public void checkUncheckAll(){
for(CheckBoxWrapper wrapObj : wrapperAccList){
wrapObj.flag = mainBoxValue;
}
}
public class CheckBoxWrapper{
public Boolean flag{get;set;}
public Opportunity oppObj{get;set;}
public CheckBoxWrapper(Boolean flagValue,Opportunity oppObj){
this.flag = flagValue;
this.oppObj = oppObj;
}
}
}
if you found this answer helpful then please mark it as best answer so it can help others.
Thanks
Ajay Dubedi