I have a list of open and closed opps from a selectedaccount, this works fine. But if I want to change the picklist fields (RecordType, Stage) should change the dependent field. The fields Stage and Probability standardfields and the values are stored in salesforce.
RecordType(Product) --> Stage --> Probility
But If I run this like in my code below, the dependence doesn't work.
For example: If I change the recordtype to product 3 the field stage should show Stage1 and Stage2 and the dependet field get blank. And If I change the stage the dependent field should adapt.
CLASS
Public List <Opportunity> getOppList2() {
OppList1 = [SELECT Id, Name, RecordTypeId, RecordType.Name, StageName, Amount, CloseDate, Probability, Bewertung_in__c FROM Opportunity WHERE AccountId = :SelectedAccountId AND IsClosed = false ORDER BY CloseDate DESC];
RETURN OppList1;
}
Public List <Opportunity> getOppListClosed2() {
OppListClosed1 = [SELECT Id, Name, RecordTypeId, RecordType.Name, StageName, Amount, CloseDate, Probability, Bewertung_in__c FROM Opportunity WHERE AccountId = :SelectedAccountId AND IsClosed = true ORDER BY CloseDate DESC LIMIT 10];
RETURN OppListClosed1;
}
Public pageReference getOppList() {
getOppList2();
getOppListClosed2();
RETURN NULL;
}
Public PageReference SaveInlineListChanges() {
UPDATE OppList1;
UPDATE OppListClosed1;
RETURN NULL;
}
Public PageReference CancelInlineListChanges() {
RETURN ApexPages.CurrentPage();
}
VISUALFORCE
<apex:outputpanel id="oppOppList">
<apex:pageblock title="Opportunity List" id="pbOpp" mode="inlineEdit">
<apex:pageBlockButtons location="top">
<apex:commandButton action="{!SaveInlineListChanges}" value="save" id="saveButton0"/>
<apex:commandButton action="{!CancelInlineListChanges}" value="cancel" id="cancelButton0"/>
</apex:pageBlockButtons>
<apex:outputtext style="font-size:12pt; font-weight: bold" value="open Opps"/>
<apex:pageblocktable value="{!OppList2}" title="open Opps" var="Opp" columnsWidth="5%,15%,15%,10%,15%,15%,5%,20%">
<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:inputfield value="{!Opp.RecordTypeId}" required="true"/> </apex:column>
<apex:column headervalue="Amount"> <apex:inputfield value="{!Opp.Amount}" style="width:90px" required="true"/> </apex:column>
<apex:column headervalue="Amount in"> <apex:inputfield value="{!Opp.Amount_in__c}" required="true"/> </apex:column>
<apex:column headervalue="Stage"> <apex:inputfield value="{!Opp.StageName}" required="true"/> </apex:column>
<apex:column headervalue="Probility"> <apex:inputfield value="{!Opp.Probability}" style="width:60px" required="true"/> </apex:column>
<apex:column headervalue="Close Date"> <apex:inputfield value="{!Opp.CloseDate}" required="true"/> </apex:column>
</apex:pageblocktable>
<br/>
<apex:outputtext style="font-size:12pt; font-weight: bold" value="closed Opps" />
<apex:pageblocktable value="{!OppListClosed2}" title="geschlossene Verkaufschancen" var="Opp" rendered="{!IF(newOpp=0,true,false)}" columnsWidth="5%,15%,15%,10%,15%,15%,5%,20%">
<apex:column headervalue="LINK"> <apex:outputLink target="_blank" value="/{!Opp.Id}">Details</apex:outputLink> </apex:column>
<apex:column headervalue="Name"> <apex:outputtext value="{!Opp.Name}"/> </apex:column>
<apex:column headervalue="Product"> <apex:outputtext value="{!Opp.RecordType.Name}"/> </apex:column>
<apex:column headervalue="Amount">
<apex:outputText value="{0, number, #,##0}"> <apex:param value="{!Opp.Amount}"/> </apex:outputText>
</apex:column>
<apex:column headervalue="Amount in"> <apex:outputtext value="{!Opp.Amount_in__c}"/> </apex:column>
<apex:column headervalue="Stage"> <apex:inputfield value="{!Opp.StageName}"/> </apex:column>
<apex:column headervalue="Probability"> <apex:outputtext value="{!Opp.Probability}" style="width:60px"/> </apex:column>
<apex:column headervalue="Schlussdatum">
<apex:outputText value="{0,date,dd'.'MM'.'yyyy}"> <apex:param value="{!Opp.CloseDate}"/> </apex:outputText>
</apex:column>
</apex:pageblocktable>
</apex:pageBlock>
</apex:outputpanel>