I have a list of all open opportunities and the possibility to edit the list. Also I have the depending field recordtype (product) connected with stagename. If I change the recordtype the picklist of stages should update. But if I change the recordtype the stagenames updates not very well.

<apex:outputpanel id="oppOppList">
<apex:pageblock title="Opportunities" id="pbOpp" mode="inlineEdit">
<apex:outputtext style="font-size:12pt; font-weight: bold" value="open Opportunities"/>
<apex:pageblocktable value="{!OppList2}" title="open Opportunities" var="Opp">
    <apex:column headervalue="LINK"> <apex:outputLink target="_blank" value="/{!Opp.Id}">Details</apex:outputLink> </apex:column>
    <apex:column headervalue="Name"> <apex:inputfield value="{!Opp.Name}" required="true"/> </apex:column>    

    <apex:column headervalue="Product">
        <apex:selectList value="{!SelectedRType}" size="1" multiselect="false" style="width:150px">
            <apex:actionSupport event="onchange" action="{!getStageList}" reRender="StageRefresh"/>
            <apex:selectOptions value="{!RTypeList}" />             

    <apex:column headervalue="Amount"> <apex:inputfield value="{!Opp.Amount}" required="true"/> </apex:column>

    <apex:column headervalue="Stage" id="StageRefresh">
        <apex:selectList size="1" multiselect="false" style="width:150px">
            <apex:selectOptions value="{!StageOptionList}" />             

    <apex:column headervalue="Close Date"> <apex:inputfield value="{!Opp.CloseDate}" required="true"/> </apex:column>              

Public class depen001class {

Public String SelectedRType {get; set;}
Public List <SelectOption> StageOptionList { get; set; }
Public List <Opportunity> OppList1 {get; set;}

Public depen001class () {

Public List <Opportunity> getOppList2() {
OppList1 =  [SELECT Id, Name, RecordTypeId, RecordType.Name, Amount, CloseDate FROM Opportunity WHERE AccountId = '001g000000dzT5rAAE' AND IsClosed = false ORDER BY CloseDate DESC];
RETURN OppList1;

Public pageReference getOppList() {

Public List <SelectOption> getRTypeList() {
List <RecordType > RTypes = [SELECT Id, Name FROM RecordType WHERE sObjectType = 'Opportunity'];
List <SelectOption> RTypeOptionList = new List <SelectOption>();
FOR (RecordType R : RTypes) {
    RTypeOptionList.add (new SelectOption(R.Name, R.Name));
RETURN RTypeOptionList; 

Public void getStageList() {
StageOptionList = new List <SelectOption>();   

    IF(SelectedRType == 'Entgeltumwandlung') {
        StageOptionList.add (new SelectOption('0', 'PO'));
        StageOptionList.add (new SelectOption('30', 'TE'));
        StageOptionList.add (new SelectOption('50', 'KU'));
        StageOptionList.add (new SelectOption('75', 'AU'));
        StageOptionList.add (new SelectOption('90', 'UM'));
        StageOptionList.add (new SelectOption('100', 'GW'));
        StageOptionList.add (new SelectOption('0', 'GV'));                                                                        
    IF(SelectedRType == 'Berufsunfähigkeit') {
        StageOptionList.add (new SelectOption('0', 'PO'));
        StageOptionList.add (new SelectOption('10', 'TE'));
        StageOptionList.add (new SelectOption('30', 'AU'));
        StageOptionList.add (new SelectOption('70', 'UM'));
        StageOptionList.add (new SelectOption('100', 'GW'));
        StageOptionList.add (new SelectOption('0', 'GV'));  


You must log in to answer this question.

Browse other questions tagged .