I have 2 lists, they show the ForecastingQuota of my users for Quarter 1 and Quarter 2. I want to copy all the values of Quarter 1 to Quarter 2 if I choose the quarter on the SelectList (just copy the quota Amount of the user). How can I achieve this?
<apex:outputText>Copy Quarter</apex:outputText>
<apex:selectList value="{!selectedQuarterToCopy}" size="1">
<apex:selectOptions value="{!QuarterList}" />
</apex:selectList>
<apex:outputText>To this Quarter</apex:outputText>
<apex:selectList value="{!selectedQuarterCopied}" size="1">
<apex:selectOptions value="{!QuarterList}" />
</apex:selectList>
<apex:commandButton value="Copy Quarter to Quarter" action="{!copyQuarterToQuarter}" styleClass="buttonCopyQuota" reRender="null" />
List<ForecastingQuota> queryQuotaListQ1 = [SELECT Id, QuotaAmount, QuotaOwnerId, QuotaOwner.UserRole.Name, StartDate FROM ForecastingQuota WHERE ForecastingTypeId = :forecastTypeList.get(0).Id AND StartDate >=:selectedQuarterQ1 AND StartDate <:selectedQuarterQ2 AND QuotaOwnerId IN : userIdSet ORDER BY QuotaOwnerId ASC];
List<ForecastingQuota> queryQuotaListQ2 = [SELECT Id, QuotaAmount, QuotaOwnerId, QuotaOwner.UserRole.Name, StartDate FROM ForecastingQuota WHERE ForecastingTypeId = :forecastTypeList.get(0).Id AND StartDate >=:selectedQuarterQ2 AND StartDate <:selectedQuarterQ3 AND QuotaOwnerId IN : userIdSet ORDER BY QuotaOwnerId ASC];