• Jeremy Deseez
  • NEWBIE
  • 35 Points
  • Member since 2016

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 17
    Questions
  • 24
    Replies
Hello,

I have a VF page which is available to sustem admin but not available in to user in "partner portal",i have given access to profiles to this page, is there something i am missing.. ?
Hello,

How can I make a custom fields lookup relationship to OpportunitySplit ?
Because when I create the field, I can only make a lookup to Opportunity.

Regards
Jeremy
Hello,
I have a table with multiple rows, and a selectoptions for each row.
When I have only one row, I can get the value (fol.Type__c = typeOfOpp;) in my controller, but if there is many rows, the value is "none".

Apex Code : 
public String typeOfOpp{get;set;}

public List<SelectOption> loadFastType(){
		fastType = new List<SelectOption>();
		fastType.add(new SelectOption('none', '-- Select Type --'));
		fastType.add(new SelectOption('Optimist', 'Optimist'));
		fastType.add(new SelectOption('Forecast Exit', 'Forecast Exit'));
		fastType.add(new SelectOption('Pessimist', 'Pessimist'));
		return fastType;
	}

public void saveValue(){
		List<FAST_OPP__c> fastOppListToSave = new List<FAST_OPP__c>();
		for(FAST_OPP__c fol : fastOppList){
			fol.Opp_ID__r = null;
			fol.Type__c = typeOfOpp;
			fastOppListToSave.add(fol);
		}
		try {
			//upsert fastOppList;
			upsert fastOppListToSave;
		} catch (exception ex) {
			System.debug(ex);
		}
	}


Kind regards
Hello guys,
I've got some problem with my save method, nothing happen, even the System.debug is not launch on the Debug Log;
Thanks for your help
Here my VFP and Controller code : 
public with sharing class ManageFAST {

	public List<SelectOption> 							quarterList {get;set;}
	public List<SelectOption> 							fastType{get;set;}
	public Map<Id, FAST__c>								mapFast{get;set;}
	public FAST__c 										fast{get;set;}
	public List<FAST_OPP__c> 							fastOppList{get;set;}
	//public List<AggregateResult> 						fastOppListSum{get;set;}

	public String 										typeOfOpp{get;set;}
	public Decimal 										sumOfAmount{get;set;}

	//public List<FAST__c> 								fastList{get;set;}

	private List<ManageOpp>								manageOppList{get;set;}
	private manageUser 									oppUser;
	private ManageOpp 									oppOpp;
	public Date 										quarter{get;set;}
	public String 										selectedQuarter {get;set;}
	public Date 										selectedQuarterReturn{get;set;}
	public Date 										testdate{get;set;}



	public ManageFAST() {
		fast = new FAST__c();
		//fastList = new List<FAST__c>();
		fastOppList = new List<FAST_OPP__c>();
		oppUser = new ManageUser();
		oppOpp = new ManageOpp();

		oppUser.load(UserInfo.getUserId());
		quarter = Date.today();
		quarterList = loadQuarterList();
		loadFastType();
		loadFAST();
		loadFASTOPP();
		initFASTOppList();
	}


	public List<SelectOption> loadFastType(){
		fastType = new List<SelectOption>();
		fastType.add(new SelectOption('none', '-- Select Type --'));
		fastType.add(new SelectOption('Optimist', 'Optimist'));
		fastType.add(new SelectOption('Forecast Exit', 'Forecast Exit'));
		fastType.add(new SelectOption('Pessimist', 'Pessimist'));
		return fastType;
	}

	public List<SelectOption> loadQuarterList() {
		List<SelectOption> optionsquarter = new List<SelectOption>();
		List<Period> resultsquarter = [SELECT EndDate, FullyQualifiedLabel, StartDate, Type
		FROM Period 
		WHERE Type = 'Quarter' AND StartDate >= LAST_YEAR];
		for(Period rq : resultsquarter){
		optionsquarter.add(new SelectOption(String.valueOf(rq.get('StartDate')),String.valueOf(rq.get('FullyQualifiedLabel'))));
		
		}
		return optionsquarter;
	}


	public void loadFAST(){
		if(selectedQuarterReturn == null){
			selectedQuarterReturn = Date.today();
		} else {
			selectedQuarterReturn = Date.valueOf(selectedQuarter);
		}
		List<FAST__c> fastList = new List<FAST__c>();
		fastList = [SELECT Id, Sales_ID__c, Forecast_Manager_ID__c, Quarter_Date__c, Commit_Manager__c, Transactionnal_Amount_Forecast_Exit__c, 
					Transactionnal_Amount_Optimistic__c, Transactionnal_Amount_Pessimistic__c,Opp_Amount_Optimist__c,
					Opp_Amount_Forecast_Exit__c, Opp_Amount_Pessimist__c
					FROM FAST__c 
					WHERE Sales_ID__c =: oppUser.getId()
					//AND Quarter_Date__c >=:selectedQuarterReturn 
					//LIMIT 1
					];

		if(fastList.isEmpty()){
			fast = new FAST__c();
			fast.Sales_ID__c = oppUser.getId();
			fast.Forecast_Manager_ID__c = oppUser.getManagerId();
			fast.Transactionnal_Amount_Pessimistic__c = 0;
			fast.Transactionnal_Amount_Optimistic__c = 0;
			fast.Transactionnal_Amount_Forecast_Exit__c = 0;
			//fast.Quarter_Date__c =:selectedQuarterReturn
			fast.Opp_Amount_Pessimist__c = 0;
			fast.Opp_Amount_Optimist__c = 0;
			fast.Opp_Amount_Forecast_Exit__c = 0;
			fast.Commit_Manager__c = 0;
		} else {
			fast = fastList.get(0);
		}
	}


	public void loadFASTOPP(){

		Date selectedQuarterReturn = Date.valueOf(quarterList.get(0).getValue());
		Date selectedQuarterReturnNext = Date.valueOf(quarterList.get(1).getValue());
	
			if(selectedQuarter == null){
				selectedQuarterReturn = Date.today();
			} else {
				selectedQuarterReturn = Date.valueOf(quarterList.get(0).getValue());

			}
			//System.debug(selectedQuarterReturn);
			//System.debug(selectedQuarterReturnNext);
	
			fastOppList = [SELECT Id, Opp_ID__c, IsClosed__c, Type__c, Opp_Amount__c, FAST_ID__c
			FROM FAST_OPP__c 
			WHERE IsClosed__c != true
			AND Opp_ID__r.CloseDate >=: selectedQuarterReturn
			];		
	}

	public void initFASTOppList(){
		oppUser.loadOpportunityList(quarter);
		for(ManageOpp mo : oppUser.getOpportunityList())
		{

			Map<Id, FAST_OPP__c> testMap = new Map<Id, FAST_OPP__c>();
			for(FAST_OPP__c fo : fastOppList){
				testMap.put(fo.Opp_ID__c, fo);
				//System.debug('1er test MO' + fastOppList);
			}

			if(!testMap.containsKey(mo.getOppId())){
				FAST_OPP__c fastOpp = new FAST_OPP__c();
				fastOpp.Opp_ID__c = mo.getOppId();
				fastOpp.FAST_ID__c = fast.Id;
				fastOpp.IsClosed__c = mo.getIsClosed();
				fastOpp.Opp_ID__r = new Opportunity();
				fastOpp.Opp_ID__r.Amount = mo.getAmount();
				fastOpp.Type__c = 'none';
				fastOppList.add(fastOpp);
			}
		}
	}


	public FAST__c getFAST(){
		return this.fast;
	}
public PageReference goSave() {
		System.debug('fastOppList before for = ' + fastOppList);

		List<FAST_OPP__c> fastOppListToSave = new List<FAST_OPP__c>();
		
		for(FAST_OPP__c fol : fastOppList){
			System.debug('fastOppList a the begining of the for' + fastOppList);
			fol.Opp_ID__r = null;
			//if(fol.Type__c == null){
				//fol.Type__c = typetype;
				fol.Type__c = this.typeOfOpp;
			//}
			//fol.Type__c = typetype;
			System.debug('fastOppListToSave before the add' + fastOppListToSave);
			fastOppListToSave.add(fol);
			System.debug('fastOppListToSave during for' + fastOppListToSave);
			//if(fol.Type__c != 'none'){
			//	fastOppListToSave.add(fol);
			//	System.debug('fastOppListToSave during SAVE' + fastOppListToSave);
			//}
		}
			System.debug('fastOppListToSave after for' + fastOppListToSave);

		try {
			System.debug('fastOppListToSave during save' + fastOppListToSave);
			upsert fastOppListToSave;
		} catch (exception ex) {
			System.debug(ex);
		}
		return null;
	}
 
<apex:page showHeader="true" sidebar="true" controller="ManageFAST" >

<apex:includeScript value="{!URLFOR($Resource.jquery, '/jquery-ui-1.10.3.custom/js/jquery-1.9.1.js')}" />
<apex:includeScript value="{!URLFOR($Resource.jquery, '/jquery-ui-1.10.3.custom/js/jquery-ui-1.10.3.custom.min.js')}" />





<apex:form id="formId">
<script type="text/javascript">
			$j = jQuery.noConflict();

			$j(document).ready(function() {
					var total = 0;
					$j('.optimist').each(function(){
						var t = $j(this).parent().parent().find('.optimist').val();
						total += parseFloat(t); 
					});
					$j('.grandTotal').val(total);

					$j('.type_opp').change(function(){			
					var opp_amount = $j(this).parent().parent().find('.amount_to_copy').text();

						if($j(this).parent().parent().find('.type_opp').val() == 'Pessimist'){
							$j(this).parent().parent().find('.pessimist').val(opp_amount);
							$j(this).parent().parent().find('.forecast_exit').val(opp_amount);
							$j(this).parent().parent().find('.optimist').val(opp_amount);

						} else if ($j(this).parent().parent().find('.type_opp').val() == 'Forecast Exit'){
							$j(this).parent().parent().find('.pessimist').val('');
							$j(this).parent().parent().find('.forecast_exit').val(opp_amount);
							$j(this).parent().parent().find('.optimist').val(opp_amount);

						} else if ($j(this).parent().parent().find('.type_opp').val() == 'Optimist'){
							$j(this).parent().parent().find('.pessimist').val('');
							$j(this).parent().parent().find('.forecast_exit').val('');
							$j(this).parent().parent().find('.optimist').val(opp_amount);
						}
				});
			});
		</script>


<br/><br/>
<apex:selectList value="{!selectedQuarter}"  size="1">
	<apex:selectOptions value="{!QuarterList}" />
	<apex:actionSupport event="onchange" action="{!loadFASTOPP}" reRender="formId"/>
</apex:selectList>
<br/><br/>
<apex:outputText value="{!selectedQuarterReturn}"></apex:outputText>

<apex:pageBlock>
	<apex:pageBlockTable value="{!fastOppList}" id="table" var="f" >
				<apex:column headerValue="Opportunity Name" value="{!f.Opp_ID__c}"/>
				<!-- <apex:column headerValue="Opportunity Account" value="{!f.Opp_ID__r.Account.Name}"/> -->
				<apex:column headerValue="Amount" styleClass="amount_to_copy" value="{!f.Opp_Amount__c}"/>
				<apex:column headerValue="Type">
					<apex:selectList styleClass="type_opp" value="{!typeOfOpp}"  size="1">
						<apex:selectOptions value="{!fastType}" />
					</apex:selectList>
				</apex:column>

				<apex:column headerValue="TYpe" value="{!f.Type__c}">
				</apex:column>

				<apex:column headerValue="Total Pessimistic">
				<apex:inputText styleClass="pessimist" value="{!f.Opp_Amount__c}"/>
				</apex:column>

				<apex:column headerValue="Total Forecast Exit">
				<apex:inputText styleClass="forecast_exit" value="{!f.Opp_Amount__c}"/>
				</apex:column>

				<apex:column headerValue="Total Optimistic">
				<apex:inputText styleClass="optimist" value="{!f.Opp_Amount__c}"/>
				</apex:column>
				<apex:column headerValue="Is closed ?">
				<apex:outputText value="{!f.IsClosed__c}"/>
				</apex:column>
	</apex:pageBlockTable>
</apex:pageBlock>
	
<apex:pageBlock>
		<apex:outputText>Commit Manager </apex:outputText>
		<apex:inputText value="{!sumOfAmount}" styleClass="grandTotal"/>
</apex:pageBlock>

<apex:commandButton value="Save Value" action="{!saveValue}"/>
<apex:commandButton value="SaveMoi" action="{!saveMoi}"/>
<apex:commandButton value="GoSave" action="{!goSave}"/>
<apex:commandButton value="TEST" action="{!testTest}"/>

<br/>

</apex:form>



</apex:page>

Thanks
Hello Dev Community,
I'm making an new app, named FAST.
I have two Objects : FAST and FAST_OPP. In FAST_OPP, there are informations about Opportunity, and in FAST there are other data link with FAST_OPP.
When I update FAST_OPP, I want to push also data in FAST. But I need to create ID in FAST during the upsert and I don't know how to do this.
Here's my controller code and visualforce :
 
public with sharing class ManageFAST {

	public List<SelectOption> 							quarterList {get;set;}
	public List<SelectOption> 							fastType{get;set;}

	public FAST__c 										fast{get;set;}
	public List<FAST_OPP__c> 							fastOppList{get;set;}
	private List<ManageOpp>								manageOppList{get;set;}
	private manageUser 									oppUser;
	private ManageOpp 									oppOpp;
	public Date 										quarter;
	public String 										selectedQuarter {get;set;}
	public Date 										selectedQuarterReturn{get;set;}
	public Date 										testdate{get;set;}

	public ManageFAST() {
		fast = new FAST__c();
		fastOppList = new List<FAST_OPP__c>();
		oppUser = new ManageUser();
		oppOpp = new ManageOpp();
		oppUser.load(UserInfo.getUserId());
		quarter = Date.today();
		quarterList = loadQuarterList();
		loadFastType();
		loadFAST();
		loadFASTOPP();
		initFASTOppList();
	}


	public void loadFAST(){
		List<FAST__c> fastList = new List<FAST__c>();
		fastList = [SELECT Id, Sales_ID__c, Forecast_Manager_ID__c, Quarter_Date__c, Commit_Manager__c, Transactionnal_Amount_Forecast_Exit__c, 
					Transactionnal_Amount_Optimistic__c, Transactionnal_Amount_Pessimistic__c,Opp_Amount_Optimist__c,
					Opp_Amount_Forecast_Exit__c, Opp_Amount_Pessimist__c
					FROM FAST__c 
					WHERE Sales_ID__c =: oppUser.getId()
					//AND Quarter_Date__c >=:selectedQuarterReturn 
					LIMIT 1
					];

		if(fastList.isEmpty()){
			fast = new FAST__c();
			fast.Sales_ID__c = oppUser.getId();
			fast.Transactionnal_Amount_Pessimistic__c = 0;
			fast.Transactionnal_Amount_Optimistic__c = 0;
			fast.Transactionnal_Amount_Forecast_Exit__c = 0;
			fast.Opp_Amount_Pessimist__c = 0;
			fast.Opp_Amount_Optimist__c = 0;
			fast.Opp_Amount_Forecast_Exit__c = 0;
			fast.Commit_Manager__c = 0;
		} else {
			fast = fastList.get(0);
		}
	}


	public void loadFASTOPP(){
			//selectedQuarterReturn = Date.valueOf(selectedQuarter);
			fastOppList = [SELECT Id, Opp_ID__c, IsClosed__c, Type__c, Opp_Amount__c, Opp_ID__r.Amount , Opp_ID__r.Account.Name, 
			FAST_ID__r.Transactionnal_Amount_Forecast_Exit__c,FAST_ID__r.Transactionnal_Amount_Pessimistic__c,
			FAST_ID__r.Transactionnal_Amount_Optimistic__c , FAST_ID__r.Opp_Amount_Pessimist__c, FAST_ID__r.Opp_Amount_Forecast_Exit__c ,
			FAST_ID__r.Opp_Amount_Optimist__c, FAST_ID__r.Id
			FROM FAST_OPP__c 
			WHERE IsClosed__c != true
			//WHERE FAST_ID__c =: fast.Id
			//AND FAST_ID__r.Sales_ID__c =: oppUser.getId()
			//AND FAST_ID__r.Quarter_Date__c >=: selectedQuarterReturn
			];
	}

	public void initFASTOppList(){
		oppUser.loadOpportunityList(quarter);
		for(ManageOpp mo : oppUser.getOpportunityList())
		{

			Map<Id, FAST_OPP__c> testMap = new Map<Id, FAST_OPP__c>();
			for(FAST_OPP__c fo : fastOppList){
				//System.debug('fastOppList before init' + fastOppList);

				testMap.put(fo.Opp_ID__c, fo);
				System.debug('testMap' + testMap);

				//System.debug('fastOppList after init' + fastOppList);

			}

			if(!testMap.containsKey(mo.getOppId())){
				FAST_OPP__c fastOpp = new FAST_OPP__c();
				fastOpp.Opp_ID__c = mo.getOppId();
				//fastOpp.FAST_ID__c = fast.Id;
				fastOpp.IsClosed__c = mo.getIsClosed();
				fastOpp.Type__c = 'none';
				//fastOpp.FAST_ID__r.Sales_ID__c = oppUser.getId();
				fastOppList.add(fastOpp);
				System.debug('FAST OPP LIST IN INIT AFTER ADD' + fastOppList);

			}
			//System.debug('FIRST USER DEBUG BEFORE ADD TO FAST_OPP__c' + fastOppList);
		}

		//System.debug('TEST FASTOPPLIST' + fastOppList.size());



	}


	public List<SelectOption> loadFastType(){
		fastType = new List<SelectOption>();
		fastType.add(new SelectOption('none', '-- Select Type --'));
		fastType.add(new SelectOption('Optimist', 'Optimist'));
		fastType.add(new SelectOption('Forecast Exit', 'Forecast Exit'));
		fastType.add(new SelectOption('Pessimist', 'Pessimist'));
		return fastType;
	}

	public void assignTypeCopyValue(){

	}



	public List<SelectOption> loadQuarterList() {
		List<SelectOption> optionsquarter = new List<SelectOption>();
		List<Period> resultsquarter = [SELECT EndDate, FullyQualifiedLabel, StartDate, Type
		FROM Period 
		WHERE Type = 'Quarter' AND StartDate >= LAST_YEAR];
		for(Period rq : resultsquarter){
		optionsquarter.add(new SelectOption(String.valueOf(rq.get('StartDate')),String.valueOf(rq.get('FullyQualifiedLabel'))));
		selectedQuarterReturn = Date.valueOf(rq.get('StartDate'));
		}
		//System.debug('selectedQuarterReturn' + selectedQuarterReturn);

		return optionsquarter;
	}





	public FAST__c getFAST(){
		return this.fast;
	}


	public PageReference goSave() {
		List<FAST_OPP__c> fastOppListToSave = new List<FAST_OPP__c>();
		for(FAST_OPP__c fol : fastOppList){
			System.debug('fastOppList during SAVE' + fastOppList);

			//fol.FAST_ID__c = fast.Id; // il est null la
			//fol.FAST_ID__r.Sales_ID__c = oppUser.getId();

			//System.debug('TEST fastOppListToSave' + fol.FAST_ID__c);

			if(fol.Type__c != 'none'){
				fastOppListToSave.add(fol);
				System.debug('fastOppListToSave during SAVE' + fastOppListToSave);
				//System.debug('SALES ID' + fol.FAST_ID__r.Sales_ID__c);
				//System.debug('TEST fastOppListToSave' + fastOppListToSave.size());

			}
		}
		try {
			upsert fastOppListToSave;
		} catch (exception ex) {
			System.debug(ex);
		}

		return null;
	}




}
 
<apex:page showHeader="true" sidebar="true" controller="ManageFAST" >

<apex:includeScript value="{!URLFOR($Resource.jquery, '/jquery-ui-1.10.3.custom/js/jquery-1.9.1.js')}" />
<apex:includeScript value="{!URLFOR($Resource.jquery, '/jquery-ui-1.10.3.custom/js/jquery-ui-1.10.3.custom.min.js')}" />

<apex:slds />

<div class="slds-scope">

<apex:form id="formId">

<script type="text/javascript">
			$j = jQuery.noConflict();
			
			function saveComplete() {
				window.location.reload(true);
			}
	
			function testalert(){
				alert('test alert button change typelist in top');
				console.log('test');
			};

			$j(document).ready(function() {
				console.log('Test lancement JQUERY');

					$j('.type_opp').change(function(){			
					var opp_amount = $j(this).parent().parent().find('.amount_to_copy').text();

						if($j(this).parent().parent().find('.type_opp').val() == 'Pessimist'){
							$j(this).parent().parent().find('.pessimist').val(opp_amount);
							$j(this).parent().parent().find('.forecast_exit').val(opp_amount);
							$j(this).parent().parent().find('.optimist').val(opp_amount);
							console.log('change amount to pessimist');

						} else if ($j(this).parent().parent().find('.type_opp').val() == 'Forecast Exit'){
							$j(this).parent().parent().find('.pessimist').val('');
							$j(this).parent().parent().find('.forecast_exit').val(opp_amount);
							$j(this).parent().parent().find('.optimist').val(opp_amount);
							console.log('change amount to optimist');

						} else if ($j(this).parent().parent().find('.type_opp').val() == 'Optimist'){
							$j(this).parent().parent().find('.pessimist').val('');
							$j(this).parent().parent().find('.forecast_exit').val('');
							$j(this).parent().parent().find('.optimist').val(opp_amount);
							console.log('change amount to pessimist');
						}
				});
			});
		</script>

<br/><br/>
<apex:selectList value="{!selectedQuarter}"  size="1">
	<apex:selectOptions value="{!QuarterList}" />
	<apex:actionSupport event="onchange" action="{!loadFASTOPP}" reRender="formId"/>
</apex:selectList>
<br/><br/>


<apex:pageBlock>
	<apex:pageBlockTable styleClass="slds-table slds-table--bordered slds-table--cell-buffer" value="{!fastOppList}" id="table" var="f" >
				<apex:column headerValue="Opportunity Name" value="{!f.Opp_ID__c}"/>
				<apex:column headerValue="Opportunity Account" value="{!f.Opp_ID__r.Account.Name}"/>
				<apex:column headerValue="Amount" styleClass="amount_to_copy" value="{!f.Opp_Amount__c}"/>
				<apex:column headerValue="Type">
					<apex:selectList styleClass="type_opp"  value="{!f.Type__c}"  size="1">
						<apex:selectOptions value="{!fastType}" />
					</apex:selectList>
				</apex:column>
				
				<apex:column headerValue="Total Pessimistic">
				<apex:inputText styleClass="pessimist" value="{!f.FAST_ID__r.Opp_Amount_Pessimist__c}"/>
				</apex:column>

				<apex:column headerValue="Total Forecast Exit">
				<apex:inputText styleClass="forecast_exit" value="{!f.FAST_ID__r.Opp_Amount_Forecast_Exit__c}"/>
				</apex:column>

				<apex:column headerValue="Total Optimistic">
				<apex:inputText styleClass="optimist" value="{!f.FAST_ID__r.Opp_Amount_Optimist__c}"/>
				</apex:column>
				<apex:column headerValue="Is closed ?">
				<apex:inputText styleClass="slds-input" value="{!f.IsClosed__c}"/>
				</apex:column>
				<apex:column headerValue="Id du FAST" value="{!f.FAST_ID__r.Id}"/>
				<apex:column headerValue="Id du FAST OPP" value="{!f.Id}"/>


	</apex:pageBlockTable>
</apex:pageBlock>

<apex:commandButton styleClass="slds-button--selected" value="Save" action="{!goSave}" oncomplete="saveComplete()" reRender="formId"></apex:commandButton>
<br/>
<apex:commandButton styleClass="slds-button--selected" value="TEST loadFAST" action="{!loadFAST}" oncomplete="saveComplete()" reRender="formId"></apex:commandButton>


<apex:pageBlock>
<apex:pageBlockTable styleClass="slds-table slds-table--bordered slds-table--cell-buffer" value="{!fast}" var="fr" >
				<apex:column headerValue="Opportunity Name" value="{!fr.Sales_ID__c}"/>
				
			</apex:pageBlockTable>
		</apex:pageBlock>



</apex:form>
</div>



</apex:page>

I want to copy the value stored in the visualforce table into FAST and FAST_OPP.

Best Regards,
Jeremy
 
Hello everyone,

I've got a Classe named 'ManageUser". In this class, a method extract all opportunities for users.
I've got an other Class named 'ManageFAST". In this class, I need to copy the values of the Opportunity List.
And I don't know how to do it.
Here is my code.

ManageUser : 
public Boolean loadOpportunityList(Date quarter){
		String query = ManageOpp.OPP_QUERY;
		query += ' WHERE Owner.Id =: id';
		if(quarter != null){
			query += ' AND CloseDate >=: quarter';
		}
		List<Opportunity> oppList = Database.query(query);
		if(oppList.isEmpty()){
			return false;
		}
		myOppList = new List<ManageOpp>();
		for(Opportunity opp : oppList){
			myOppList.add(new ManageOpp(opp));
		}
		return true;
	}


	public Boolean loadOpportunityList(){
		return loadOpportunityList(null);
	}

public List<ManageOpp> getOpportunityList(){
		return this.myOppList;
	}

ManageFAST : 
public List<FAST__c> 						fast{get;set;}
	private List<FAST_OPP__c> 					fastOppList;
	private List<ManageOpp>						manageOppList{get;set;}
	private manageUser 							oppUser;
	public Date 								quarter;

public ManageFAST() {
		fast = new List<FAST__c>();
		oppUser = new ManageUser();
	}

	public void loadFAST(){
		List<FAST__c> fast = new List<FAST__c>();
		fast = [SELECT Id, Sales_ID__c, Forecast_Manager_ID__c, Quarter_Date__c, Commit_Manager__c, Transactionnal_Amount_Forecast_Exit__c, Transactionnal_Amount_Optimistic__c, Transactionnal_Amount_Pessimistic__c FROM FAST__c];
	}

public void initFASTOppList(){
		oppUser.load(UserInfo.getUserId());
		//quarter = Date.newInstance(1960, 2, 17);
		oppUser.loadOpportunityList(quarter);
		

		for(FAST_OPP__c fo : oppUser.getOpportunityList())
		{
		}
 





	}

Thanks
Hi everyone,

I want to have in a report, or something like that, all the fields of all the Objects where the field is "Track History" checked at true.

Thakns for response.
Regards
Hi SFDC Dev,

I'm stuck in my dev, I have 4 columns of User Forecasting Quota. With two different picklist, I want to choose the Quarter and copy the values (Quota Amount) into the chosen Quarter picklist, for each users. See in my screenshot, I want to choose the Quarter that I want to copy on selected second Quarter.
quota
 
public void updateQuotas() {
		Map<Id, ForecastingQuota> mapOnlyForecastQuotaQ1 = new Map<Id, ForecastingQuota>();
		Map<Id, ForecastingQuota> mapOnlyForecastQuotaQ2 = new Map<Id, ForecastingQuota>();
		Map<Id, ForecastingQuota> mapOnlyForecastQuotaQ3 = new Map<Id, ForecastingQuota>();
		Map<Id, ForecastingQuota> mapOnlyForecastQuotaQ4 = new Map<Id, ForecastingQuota>();

		Map<Id, ForecastingQuota> mapQuotaQ1 = new Map<Id, ForecastingQuota>();
		Map<Id, ForecastingQuota> mapQuotaQ2 = new Map<Id, ForecastingQuota>();
		Map<Id, ForecastingQuota> mapQuotaQ3 = new Map<Id, ForecastingQuota>();
		Map<Id, ForecastingQuota> mapQuotaQ4 = new Map<Id, ForecastingQuota>();

		Set<Id> userIdSet = new Set<Id>();

		Date selectedQuarterQ1 = Date.valueOf(quarterList.get(0).getValue());
		Date selectedQuarterQ2 = Date.valueOf(quarterList.get(1).getValue());
		Date selectedQuarterQ3 = Date.valueOf(quarterList.get(2).getValue());
		Date selectedQuarterQ4 = Date.valueOf(quarterList.get(3).getValue());
		Date selectedQuarterQ5 = Date.valueOf(quarterList.get(4).getValue());

		if (selectedQuarter != null && selectedQuarter != '') {
			Integer selectedQuarterPosition = getSelectedQuarterPosition();
			selectedQuarterQ1 = Date.valueOf(quarterList.get(selectedQuarterPosition).getValue());
			selectedQuarterQ2 = Date.valueOf(quarterList.get(selectedQuarterPosition + 1).getValue());
			selectedQuarterQ3 = Date.valueOf(quarterList.get(selectedQuarterPosition + 2).getValue());
			selectedQuarterQ4 = Date.valueOf(quarterList.get(selectedQuarterPosition + 3).getValue());
			selectedQuarterQ5 = Date.valueOf(quarterList.get(selectedQuarterPosition + 4).getValue());

		}
		if (selectedUserRole == '' || selectedUserRole == null)
			selectedUserRole = 'Sales%';

		if (selectedUserRegion == '' || selectedUserRegion == null)
			selectedUserRegion = '%%';

		List<User> userList = [SELECT Id FROM User WHERE isActive =: selectedActiveUser AND ForecastEnabled = true AND UserRole.Name LIKE :selectedUserRole AND RTS_Region__c LIKE :selectedUserRegion ORDER BY Id ASC];
		for (User usr : userList)
			userIdSet.add(usr.id);
		List<ForecastingType> forecastTypeList = [SELECT Id, DeveloperName, IsActive, isAmount, isQuantity, Language, MasterLabel FROM ForecastingType WHERE DeveloperName = 'OpportunitySplitRevenue' LIMIT 1];

		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];
		List<ForecastingQuota> queryQuotaListQ3 = [SELECT Id, QuotaAmount, QuotaOwnerId, QuotaOwner.UserRole.Name, StartDate FROM ForecastingQuota WHERE ForecastingTypeId = :forecastTypeList.get(0).Id AND StartDate >=:selectedQuarterQ3 AND StartDate <:selectedQuarterQ4 AND QuotaOwnerId IN : userIdSet ORDER BY QuotaOwnerId ASC];
		List<ForecastingQuota> queryQuotaListQ4 = [SELECT Id, QuotaAmount, QuotaOwnerId, QuotaOwner.UserRole.Name, StartDate FROM ForecastingQuota WHERE ForecastingTypeId = :forecastTypeList.get(0).Id AND StartDate >=:selectedQuarterQ4 AND StartDate <:selectedQuarterQ5 AND QuotaOwnerId IN : userIdSet ORDER BY QuotaOwnerId ASC];

		for (ForecastingQuota fq1 : queryQuotaListQ1)
			mapOnlyForecastQuotaQ1.put(fq1.QuotaOwnerId, fq1);
		for (ForecastingQuota fq2 : queryQuotaListQ2)
			mapOnlyForecastQuotaQ2.put(fq2.QuotaOwnerId, fq2);
		for (ForecastingQuota fq3 : queryQuotaListQ3)
			mapOnlyForecastQuotaQ3.put(fq3.QuotaOwnerId, fq3);
		for (ForecastingQuota fq4 : queryQuotaListQ4)
			mapOnlyForecastQuotaQ4.put(fq4.QuotaOwnerId, fq4);


		for (User u : userList) {
			mapQuotaQ1.put(u.id, mapOnlyForecastQuotaQ1.containsKey(u.id) ? mapOnlyForecastQuotaQ1.get(u.id) : new ForecastingQuota(QuotaOwnerId = u.id, QuotaAmount = null, StartDate = selectedQuarterQ1, ForecastingTypeId = forecastTypeList.get(0).Id));
			mapQuotaQ2.put(u.id, mapOnlyForecastQuotaQ2.containsKey(u.id) ? mapOnlyForecastQuotaQ2.get(u.id) : new ForecastingQuota(QuotaOwnerId = u.id, QuotaAmount = null, StartDate = selectedQuarterQ2, ForecastingTypeId = forecastTypeList.get(0).Id));
			mapQuotaQ3.put(u.id, mapOnlyForecastQuotaQ3.containsKey(u.id) ? mapOnlyForecastQuotaQ3.get(u.id) : new ForecastingQuota(QuotaOwnerId = u.id, QuotaAmount = null, StartDate = selectedQuarterQ3, ForecastingTypeId = forecastTypeList.get(0).Id));
			mapQuotaQ4.put(u.id, mapOnlyForecastQuotaQ4.containsKey(u.id) ? mapOnlyForecastQuotaQ4.get(u.id) : new ForecastingQuota(QuotaOwnerId = u.id, QuotaAmount = null, StartDate = selectedQuarterQ4, ForecastingTypeId = forecastTypeList.get(0).Id));
		}

		quotaListQ1 = mapQuotaQ1.values();
		quotaListQ2 = mapQuotaQ2.values();
		quotaListQ3 = mapQuotaQ3.values();
		quotaListQ4 = mapQuotaQ4.values();
	}

public PageReference copyQuarterToQuarter(){

		Date selectedQuarterToCopy = Date.valueOf(quarterList2.get(0).getValue());
		Date selectedQuarterCopied = Date.valueOf(quarterList3.get(0).getValue());

		System.debug(quotaListQ1);
		System.debug(quotaListQ2);

		for(ForecastingQuota qq2 : quotaListQ2){
		quotaListQ2[1].QuotaAmount = quotaListQ1[1].QuotaAmount;
	}
		update quotaListQ2;
		System.debug(quotaListQ2);
		return null;
	}

Thanks all.
Hello SFDC Dev,

I have a pageblock table that's show Quotas of Sales.
I have a picklist (this picklist works) of user role, and the rerender work for the table.
But when I put a picklist of Date, nothing happens for the table and the value of the picklist is not send to the controller.
Some code :
<apex:outputlabel value="User Role"/>
	<apex:selectList value="{!idofuserrole}"  size="1">
	<apex:actionSupport event="onchange" action="{!searchQuotas}" reRender="allquotas"/>
	<apex:selectOptions value="{!userrole}"  />
	</apex:selectList>

		<apex:outputlabel value="Quarter"/>
	<apex:selectList value="{!namequarter}"  size="1">
	<apex:actionSupport event="onchange" action="{!searchQuotas}" reRender="allquotas"/>
	<apex:selectOptions value="{!QuarterList}" />
	</apex:selectList>
	
	<apex:pageBlockTable value="{!allthequotas}" id="table" var="key" title="{!namequarter}">
	<apex:facet name="header">
	
	<input type="checkbox" id="checkAllBox" onchange="toggleCheckAll(this)"/> Select Quarter 
	</apex:facet>
	<apex:column>
	<input type="checkbox" data-inputid="val1"/>
	</apex:column>
	<apex:column headerValue="Name">
	<apex:outputField  value="{!key.QuotaOwnerId}"/>
	</apex:column>
	<apex:column headerValue="Quota">
	<apex:inputField value="{!key.QuotaAmount}" required="false" id="val1"/>
	</apex:column>
	<apex:column headerValue="Quota">
	<apex:inputField value="{!key.StartDate}" required="false"/>
	</apex:column>
	</apex:pageBlockTable>
	
	
	public Date namequarter{get{
		if(namequarter == null){
		namequarter = Date.today();

	}return namequarter;
	}
	set;
}

	
	public List<SelectOption> getQuarterList(){
	List<SelectOption> optionsquarter = new List<SelectOption>();
	List<SObject> resultsquarter = [SELECT FullyQualifiedLabel,EndDate,StartDate,Type
	FROM Period
	WHERE Type = 'Quarter'
	AND StartDate >= TODAY];
	for(SObject rq : resultsquarter){
		optionsquarter.add(new SelectOption(String.valueOf(rq.get('StartDate')),String.valueOf(rq.get('StartDate'))));
	}
	return optionsquarter;
}
Thanks for your responses.

 
Hi SFDC,

I have a problem when I update some rows on my table, the update are made on all rows and not on the selected one.
<apex:pageBlockSection columns="4" id="allquotas">
<apex:pageBlockTable value="{!allthequotas}" id="table" var="key">
<apex:facet name="header">
<input type="checkbox" id="checkAllBox" onchange="toggleCheckAll(this)"/> Select All
</apex:facet>
<apex:column>
<!-- <apex:inputCheckbox styleClass="selectInput"/> -->
<input type="checkbox" data-inputid="val1"/>
</apex:column>
<apex:column headerValue="Name">
<apex:outputField  value="{!key.QuotaOwnerId}"/>
</apex:column>
<apex:column headerValue="Quota">
<apex:inputField value="{!key.QuotaAmount}" required="false" id="val1"/>
</apex:column>
</apex:pageBlockTable>
<apex:pageBlockTable value="{!allthequotas2}" var="key2">
<apex:facet name="header">
<input type="checkbox" id="checkAllBox2" onchange="toggleCheckAll2(this)"/> Select All
</apex:facet>
<apex:column>
<apex:inputCheckbox styleClass="selectInput2"/>
</apex:column>
<apex:column headerValue="Name">
<apex:outputField  value="{!key2.QuotaOwnerId}"/>
</apex:column>
<apex:column headerValue="Quota">
<apex:inputField value="{!key2.QuotaAmount}" required="false" id="test"/>
</apex:column>
</apex:pageBlockTable> 
<apex:pageBlockTable value="{!allthequotas3}" var="key3">
<apex:facet name="header">
<input type="checkbox" id="checkAllBox3" onchange="toggleCheckAll3(this)"/> Select All
</apex:facet>
<apex:column>
<apex:inputCheckbox styleClass="selectInput3"/>
</apex:column>
<apex:column headerValue="Name">
<apex:outputField  value="{!key3.QuotaOwnerId}"/>
</apex:column>
<apex:column headerValue="Quota">
<apex:inputField value="{!key3.QuotaAmount}" required="false" id="test"/>
</apex:column>
</apex:pageBlockTable> 
<apex:pageBlockTable value="{!allthequotas4}" var="key4">
<apex:facet name="header">
<input type="checkbox" id="checkAllBox4" onchange="toggleCheckAll4(this)"/> Select All
</apex:facet>
<apex:column>
<input type="checkbox" styleClass="selectInput4"/>
</apex:column>
<apex:column headerValue="Name">
<apex:outputField  value="{!key4.QuotaOwnerId}"/>
</apex:column>
<apex:column headerValue="Quota">
<apex:inputField value="{!key4.QuotaAmount}" required="false" id="test"/>
</apex:column>
</apex:pageBlockTable> 
</apex:pageBlockSection>
</apex:pageBlock>

function copyQuotaAmount()
    {
        $("input[type=checkbox]:checked").each(function(){
            // $(this) refers to the current checked box in loop
            var inputid = $(this).data('inputid');
            console.log(inputid);

            var valuetocopy = $("input[id$='ValueToCopy']").val();
            console.log(valuetocopy);
            $("input[type='text'][id$='" + inputid + "']").val(valuetocopy);
            // $("input[type='text'][id$=inputid]").val(valuetocopy);
        });
    }

 
Hi SFDC Dev,

Here's my problem. I want to copy the value of the inputfield named "CopyToValue" to the selected fields on the table.
 
<apex:inputText id="ValueToCopy" value="{!ForecastingQuota.QuotaAmount}" required="false"/>

<apex:commandButton value="Assign to Selected Users" reRender="allquotas" onclick="copyQuotaAmount();"/>
<br/> <br/> 

<apex:pageBlockSection columns="4" id="allquotas">
<apex:pageBlockTable value="{!allthequotas}" id="table" var="key">
<apex:facet name="header">
<input type="checkbox" id="checkAllBox" onchange="toggleCheckAll(this)"/> Select All
</apex:facet>
<apex:column>
<apex:inputCheckbox styleClass="selectInput"/>
</apex:column>
<apex:column headerValue="Name">
<apex:outputField  value="{!key.QuotaOwnerId}"/>
</apex:column>
<apex:column headerValue="Quota">
<apex:inputField value="{!key.QuotaAmount}" required="false" id="test"/>
</apex:column>
<apex:column headerValue="Date">
<apex:inputField value="{!key.StartDate}" required="false"/>
</apex:column>
</apex:pageBlockTable>
<apex:pageBlockTable value="{!allthequotas2}" var="key2">
<apex:facet name="header">
<input type="checkbox" id="checkAllBox2" onchange="toggleCheckAll2(this)"/> Select All
</apex:facet>
<apex:column>
<apex:inputCheckbox styleClass="selectInput2"/>
</apex:column>
<apex:column headerValue="Name">
<apex:outputField  value="{!key2.QuotaOwnerId}"/>
</apex:column>
<apex:column headerValue="Quota">
<apex:inputField value="{!key2.QuotaAmount}" required="false" id="test"/>
</apex:column>
<apex:column headerValue="Date">
<apex:inputField value="{!key2.StartDate}" required="false"/>
</apex:column>
</apex:pageBlockTable> 
<apex:pageBlockTable value="{!allthequotas3}" var="key3">
<apex:facet name="header">
<input type="checkbox" id="checkAllBox3" onchange="toggleCheckAll3(this)"/> Select All
</apex:facet>
<apex:column>
<apex:inputCheckbox styleClass="selectInput3"/>
</apex:column>
<apex:column headerValue="Name">
<apex:outputField  value="{!key3.QuotaOwnerId}"/>
</apex:column>
<apex:column headerValue="Quota">
<apex:inputField value="{!key3.QuotaAmount}" required="false" id="test"/>
</apex:column>
<apex:column headerValue="Date">
<apex:inputField value="{!key3.StartDate}" required="false"/>
</apex:column>
</apex:pageBlockTable> 
<apex:pageBlockTable value="{!allthequotas4}" var="key4">
<apex:facet name="header">
<input type="checkbox" id="checkAllBox4" onchange="toggleCheckAll4(this)"/> Select All
</apex:facet>
<apex:column>
<apex:inputCheckbox styleClass="selectInput4"/>
</apex:column>
<apex:column headerValue="Name">
<apex:outputField  value="{!key4.QuotaOwnerId}"/>
</apex:column>
<apex:column headerValue="Quota">
<apex:inputField value="{!key4.QuotaAmount}" required="false" id="test"/>
</apex:column>
<apex:column headerValue="Date">
<apex:inputField value="{!key4.StartDate}" required="false"/>
</apex:column>
</apex:pageBlockTable> 
</apex:pageBlockSection>

<script type="text/javascript">
    function copyQuotaAmount() {
    $("input[id$='test']").val($("input[id$='ValueToCopy']").val());        
    return false;
}
</script>
I just don't know how to do in JQuery. See the screenshot, I want to put the value "123" (in yellow) to the selected fields of the table. 
User-added image

Thanks everybody.
 
Hi SF Dev,

I have a PageBlockTable that return the users with their related quotas in a <apex:inputField.
All I want is to save it when I change the amount of the quota, but when I click on save, nothing happen, the page is refreshing with the old data on the table.

Here is my apex code :
public with sharing class AssignQuotaTest {

public List<ForecastingQuota> resultsquotas{get;set;}
public List<ForecastingQuota> resultsquotas2{get;set;}
public List<ForecastingQuota> allthequotas{get;set;}
public List<USer> resultsusers{get;set;}

public Map<Id, ForecastingQuota> allUserFqsByOwnerId {get;set;}
public Map<Id, ForecastingQuota> fqsByOwnerId {get;set;}

public String QuotaAmount{get;set;}
public Id QuotaOwnerId{get;set;}
public String QuotaQuantity{get;set;}
public Id PeriodId{get;set;}
public String ProductFamily{get;set;}
public Boolean IsQuantity{get;set;}
public String CurrencyIsoCode{get;set;}
public Id ForecastingTypeId{get;set;}
public Boolean IsAmount{get;set;}


public Date dateperiod{get;set;}
public Date dateperiodlist {get;set;}
public Date dateperiodlist1 {get;set;}
public Date datetest {get;set;}

public String testquarter {get;set;}
public Date countryOptions {get;set;}
public Date theperiodlist {get;set;}
public Date theperiodlist2 {get;set;}

public String next{get;set;}
public String previous{get;set;}
public Date namequarter{get;set;}

public Date namequarter2{get;set;}

public String assignquotaamount {get;set;}

public Id idofuserrole{get;set;}
public Id idofuserrole1{get;set;}
public Id idofuserrole2{get;set;}

public Boolean usertype {get;set;}
public Boolean usertype2 {get;set;}
public Boolean usertypetest {get;set;}

public string testtest2{get;set;}
public string testtest{get;set;}

public Boolean changeuser{get;set;}




public AssignQuotaTest(ApexPages.StandardController controller) {

	    searchQuotas();
	}
	
	public void searchQuotas(){
		System.debug(changeuser);
		if(namequarter == null) {
			namequarter = Date.today();
		}

		if(next == 'next'){
			namequarter = namequarter.addDays(90);
		}  


		if(previous == 'previous'){
			namequarter = namequarter.addDays(-90);
		} 

		namequarter2 = namequarter.addDays(90);
		
		if(theperiodlist == null){
			theperiodlist = Date.today();
		}

		theperiodlist2 = theperiodlist.addDays(90);
		


		List<ForecastingQuota> resultsquotas = new List<ForecastingQuota>();
	    resultsquotas = [SELECT Id,QuotaAmount,QuotaOwnerId, StartDate FROM ForecastingQuota WHERE StartDate >=:namequarter AND StartDate <=:namequarter2 ORDER BY QuotaOwnerId ASC];
	    List<User> resultsusers = new List<User>();
	    if(idofuserrole != null){
	    		resultsusers = [SELECT Id FROM User WHERE IsActive =:changeuser AND ForecastEnabled = TRUE AND UserRoleId =:idofuserrole];
	    	} else {
				resultsusers = [SELECT Id FROM User WHERE IsActive =:changeuser AND ForecastEnabled = TRUE];
			}
			
		Map<Id, ForecastingQuota> fqsByOwnerId = new Map<Id, ForecastingQuota>();
			for (ForecastingQuota fq : resultsquotas)
			{
			    fqsByOwnerId.put(fq.QuotaOwnerId, fq);
			}
		
			// new map of quotas keyed by all user ids
		Map<Id, ForecastingQuota> allUserFqsByOwnerId = new Map<Id, ForecastingQuota>();
			for (User u : resultsusers)
			{
			     allUserFqsByOwnerId.put(u.id, fqsByOwnerId.containsKey(u.id) ? fqsByOwnerId.get(u.id) : new ForecastingQuota(QuotaOwnerId = u.id, QuotaAmount = null));
			    	
			}
			allthequotas = new List<ForecastingQuota>();
			allthequotas = allUserFqsByOwnerId.values();
			allthequotas.sort();
	}



	public List<SelectOption> getQuarterDate() {
	        List<SelectOption> countryOptions = new List<SelectOption>();
	        countryOptions.add(new SelectOption('','-None-'));
	        countryOptions.add(new SelectOption('12/01/2016','Q4 2016'));
	        countryOptions.add(new SelectOption('01/01/2017','Q1 2017'));
	        countryOptions.add(new SelectOption('04/01/2017','Q2 2017'));
	        countryOptions.add(new SelectOption('07/01/2017','Q3 2017'));

	 
	        return countryOptions;
	}

 	public List<SelectOption> getPeriodList(){
 		List<SelectOption> optionspl = new List<SelectOption>();
 		List<SObject> resultspl = [SELECT FullyQualifiedLabel,EndDate,IsForecastPeriod,StartDate
									FROM Period
									WHERE EndDate > TODAY
									AND Type != 'Year'
									AND IsForecastPeriod = true
									ORDER BY EndDate ASC];
 		for(SObject pl : resultspl){
 			optionspl.add(new SelectOption(String.valueOf(pl.get('StartDate')),String.valueOf(pl.get('FullyQualifiedLabel'))));
 		}
 		return optionspl;
 	}


  	public List<SelectOption> getQuarterList(){
  		List<SelectOption> optionsquarter = new List<SelectOption>();
  		List<SObject> resultsquarter = [SELECT FullyQualifiedLabel,EndDate,StartDate,Type
										FROM Period
										WHERE Type = 'Quarter'
										AND StartDate >= TODAY];
		for(SObject rq : resultsquarter){
			optionsquarter.add(new SelectOption(String.valueOf(rq.get('StartDate')),String.valueOf(rq.get('FullyQualifiedLabel'))));
		}
		return optionsquarter;
  	}


 	public List<SelectOption> getUserActive(){
 		List<SelectOption> optionsua = new List<SelectOption>();
 		List<SObject> resultsua = [SELECT IsActive FROM User GROUP BY IsActive ORDER BY IsActive DESC];
 		for(SObject ua : resultsua){
 			optionsua.add(new SelectOption(String.valueOf(ua.get('IsActive')),String.valueOf(ua.get('IsActive'))));
 		}
 		return optionsua;
 	}


 	public List<SelectOption> getUserRole(){

 		List<SelectOption> optionsur = new List<SelectOption>();
 		List<SObject> resultsur = [SELECT Id, Name FROM UserRole WHERE Name LIKE '%Sales/%'];
 		for(SObject ur : resultsur){
 			
 			optionsur.add(new SelectOption(String.valueOf(ur.get('Id')),String.valueOf(ur.get('Name'))));
 		}optionsur.add(new SelectOption('','ALL'));
 		return optionsur;

 	}
	public List<User> getUsers(){
		List<User> resultsusers = new List<User>();
		resultsusers = [SELECT Id, Name FROM User WHERE IsActive = TRUE AND ForecastEnabled = TRUE LIMIT 999];
		return resultsusers; 
	}

	public void save(){
		
		upsert resultsquotas;
	}

}

And here is my visualforce :
 
<apex:page standardController="ForecastingQuota" extensions="AssignQuotaTest" sidebar="false" docType="html-5.0">


<apex:form id="formid">

<apex:pageBlock title="Kyriba Quotas" id="allthequotas">
<apex:pageBlockSection columns="2">

	<apex:outputlabel value="Date"/>
	<apex:input type="date" required="false" id="namequarter" value="{!namequarter}"/>

	<apex:outputlabel value="User Role"/>
	<apex:selectList value="{!idofuserrole}" size="1">
    	<apex:selectOptions value="{!userrole}" />
	</apex:selectList>

	<!-- <apex:outputlabel value="Active Users"/>
	<apex:selectList value="{!usertype}" size="1">
		<apex:selectOptions value="{!useractive}" />
	</apex:selectList><br/><br/> -->

<apex:commandButton value="Inactive Users" reRender="allquotas" action="{!searchQuotas}">
	<apex:param id="inactive" name="inactive" value="false" assignTo="{!changeuser}" /> 
</apex:commandButton>
<apex:commandButton value="Active Users" reRender="allquotas" action="{!searchQuotas}">
	<apex:param id="active" name="active" value="true" assignTo="{!changeuser}" /> 
</apex:commandButton>



<ul></ul>

<input type="checkbox" id="select_all"/>First Column<br/>
<input type="checkbox" id="select_all2"/>Second Column<br/>
<input type="checkbox" id="select_all3"/>Third Column<br/>
<input type="checkbox" id="select_all4"/>Fourth Column<br/>

<apex:commandButton id="saveBtn" value="Save" action="{!save}" />
<apex:commandButton value="Filter" reRender="allquotas" action="{!searchQuotas}">
</apex:commandButton>
 
</apex:pageBlockSection>

<br/><br/>
	<apex:pageBlockSection columns="4" id="allquotas">
			<apex:pageBlockTable value="{!allthequotas}" id="table" var="key">
			<apex:column>
			    <apex:inputCheckbox id="checkbox" styleClass="checkbox1"/>
			</apex:column>
			<apex:column headerValue="Name">
			    <apex:outputField  value="{!key.QuotaOwnerId}"/>
			</apex:column>
			<apex:column headerValue="Quota">
		    	<apex:inputField value="{!key.QuotaAmount}" required="false"/>
		    </apex:column>
			</apex:pageBlockTable>
			 <apex:pageBlockTable value="{!allthequotas}" var="key2">
			 <apex:facet name="header">
            	<input type="checkbox"  id="checkbox" styleClass="checkbox1"/>
            </apex:facet>
			<apex:column>
			    <apex:inputCheckbox id="checkbox" styleClass="checkbox2"/>
			</apex:column>
				<apex:column headerValue="Name">
				    <apex:outputField value="{!key2.QuotaOwnerId}"/>
				</apex:column>
    			  <apex:column headerValue="Quota">
			    	<apex:inputField value="{!key2.QuotaAmount}" id="firstquota2" required="false"/>
			    </apex:column> 
			    <apex:column headerValue="Quota">
			    	<apex:outputField value="{!key.StartDate}"/>
			    </apex:column>
			</apex:pageBlockTable> 
			 <apex:pageBlockTable value="{!allthequotas}" var="key3">
			 <apex:facet name="header">
            	<input type="checkbox"  id="checkbox" styleClass="checkbox1"/>
            </apex:facet>
			<apex:column>
			    <apex:inputCheckbox id="checkbox" styleClass="checkbox3"/>
			</apex:column>
				<apex:column headerValue="Name">
				    <apex:outputField value="{!key3.QuotaOwnerId}"/>
				</apex:column>
    			  <apex:column headerValue="Quota">
			    	<apex:inputField value="{!key3.QuotaAmount}" required="false"/>
			    </apex:column> 
			</apex:pageBlockTable> 
			 <apex:pageBlockTable value="{!allthequotas}" var="key4">
			 <apex:facet name="header">
            	<input type="checkbox"  id="checkbox" styleClass="checkbox1"/>
            </apex:facet>
			<apex:column>
			    <apex:inputCheckbox id="checkbox" styleClass="checkbox4"/>
			</apex:column>
				<apex:column headerValue="Name">
				    <apex:outputField value="{!key4.QuotaOwnerId}"/>
				</apex:column>
    			  <apex:column headerValue="Quota">
			    	<apex:inputField value="{!key4.QuotaAmount}" required="false"/>
			    </apex:column>
			</apex:pageBlockTable>
	</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>

<script type="text/javascript">
$(document).ready(function(){



var select_all = document.getElementById("select_all"); //select all checkbox
console.log(select_all);
var select_all2 = document.getElementById("select_all2");
var select_all3 = document.getElementById("select_all3");
var select_all4 = document.getElementById("select_all4");
var checkboxes = document.getElementsByClassName("checkbox1"); //checkbox items
console.log(checkboxes);
var checkboxes2 = document.getElementsByClassName("checkbox2");
var checkboxes3 = document.getElementsByClassName("checkbox3");
var checkboxes4 = document.getElementsByClassName("checkbox4");

//select all checkboxes
select_all.addEventListener("change", function(e){
    for (i = 0; i < checkboxes.length; i++) { 
        checkboxes[i].checked = select_all.checked;
    }
});
select_all2.addEventListener("change", function(e){
    for (i = 0; i < checkboxes2.length; i++) { 
        checkboxes2[i].checked = select_all2.checked;
    }
});
select_all3.addEventListener("change", function(e){
    for (i = 0; i < checkboxes3.length; i++) { 
        checkboxes3[i].checked = select_all3.checked;
    }
});
select_all4.addEventListener("change", function(e){
    for (i = 0; i < checkboxes4.length; i++) { 
        checkboxes4[i].checked = select_all4.checked;
    }
});


for (var i = 0; i < checkboxes.length; i++) {
    checkboxes[i].addEventListener('change', function(e){ //".checkbox" change 
        //uncheck "select all", if one of the listed checkbox item is unchecked
        if(this.checked == false){
            select_all.checked = false;
        }
        //check "select all" if all checkbox items are checked
        if(document.querySelectorAll('.checkbox:checked').length == checkboxes.length){
            select_all.checked = true;
        }
    });
}
for (var i = 0; i < checkboxes2.length; i++) {
    checkboxes2[i].addEventListener('change', function(e){ //".checkbox" change 
        //uncheck "select all", if one of the listed checkbox item is unchecked
        if(this.checked == false){
            select_all2.checked = false;
        }
        //check "select all" if all checkbox items are checked
        if(document.querySelectorAll('.checkbox2:checked').length == checkboxes2.length){
            select_all2.checked = true;
        }
    });
}
for (var i = 0; i < checkboxes3.length; i++) {
    checkboxes3[i].addEventListener('change', function(e){ //".checkbox" change 
        //uncheck "select all", if one of the listed checkbox item is unchecked
        if(this.checked == false){
            select_all3.checked = false;
        }
        //check "select all" if all checkbox items are checked
        if(document.querySelectorAll('.checkbox3:checked').length == checkboxes3.length){
            select_all3.checked = true;
        }
    });
}
for (var i = 0; i < checkboxes4.length; i++) {
    checkboxes4[i].addEventListener('change', function(e){ //".checkbox" change 
        //uncheck "select all", if one of the listed checkbox item is unchecked
        if(this.checked == false){
            select_all4.checked = false;
        }
        //check "select all" if all checkbox items are checked
        if(document.querySelectorAll('.checkbox4:checked').length == checkboxes4.length){
            select_all4.checked = true;
        }
    });
}
});


</script>
</apex:page>
Can you guide me for the custom save method ?

Many thanks.

 
Hello SFDC,

I have a method who return the Users with their associated Quotas.
It show the result in a PageBlockTable.
But I want to put 3 PageBlockTables near the first one, which show the next quarters.
It's like :
Q1                   Q2                Q3                 Q4
Tom Jones       Tom Jones     Tom Jones     Tom Jones
John Doe         John Doe       John Doe        John Doe

With my code, i got the first quarter, but I don't know how to make the next 3 quarters.

Controller :
public void searchQuotas(){
		List<ForecastingQuota> resultsquotas = new List<ForecastingQuota>();
	    resultsquotas = [SELECT Id,QuotaAmount,QuotaOwnerId, StartDate FROM  ForecastingQuota WHERE StartDate >=:namequarter AND StartDate <=:namequarter2 ORDER BY QuotaOwnerId ASC];
	    List<User> resultsusers = new List<User>();
	    if(idofuserrole != null){
	    		resultsusers = [SELECT Id FROM User WHERE IsActive =:usertype AND ForecastEnabled = TRUE AND UserRoleId =:idofuserrole];
	    	} else {
				resultsusers = [SELECT Id FROM User WHERE IsActive =:usertype AND ForecastEnabled = TRUE];
			}
			

		Map<Id, ForecastingQuota> fqsByOwnerId = new Map<Id, ForecastingQuota>();
			for (ForecastingQuota fq : resultsquotas)
			{
			    fqsByOwnerId.put(fq.QuotaOwnerId, fq);
			}
		
			// new map of quotas keyed by all user ids
		Map<Id, ForecastingQuota> allUserFqsByOwnerId = new Map<Id, ForecastingQuota>();
			for (User u : resultsusers)
			{
			     allUserFqsByOwnerId.put(u.id, fqsByOwnerId.containsKey(u.id) ? fqsByOwnerId.get(u.id) : new ForecastingQuota(QuotaOwnerId = u.id, QuotaAmount = null));
			    	
			}
			allthequotas = new List<ForecastingQuota>();
			allthequotas = allUserFqsByOwnerId.values();
			allthequotas.sort();
	}

Visualforce Page :
<apex:pageBlockSection columns="4" id="allquotas">
			<apex:pageBlockTable value="{!allthequotas}" var="key">
			<apex:column headerValue="Check">
			    <apex:inputCheckbox id="checkbox" styleClass="checkbox1"/>
			</apex:column>
			<apex:column headerValue="Name">
			    <apex:outputField  value="{!key.QuotaOwnerId}"/>
			</apex:column>
			<apex:column headerValue="Quota">
		    	<apex:inputField value="{!key.QuotaAmount}" id="test" styleClass="childCheck" required="false"/>
		    </apex:column>
		    <apex:column headerValue="Quota">
		    	<apex:outputField value="{!key.StartDate}"/>
		    </apex:column>
			</apex:pageBlockTable>
			 <apex:pageBlockTable value="{!allthequotas}" var="key2">
			<apex:column headerValue="Check">
			    <apex:inputCheckbox id="checkbox" styleClass="checkbox2"/>
			</apex:column>
				<apex:column headerValue="Name">
				    <apex:outputField value="{!key2.QuotaOwnerId}"/>
				</apex:column>
    			  <apex:column headerValue="Quota">
			    	<apex:inputField value="{!key2.QuotaAmount}" id="test2" required="false"/>
			    </apex:column> 
			    <apex:column headerValue="Quota">
			    	<apex:outputField value="{!key.StartDate}"/>
			    </apex:column>
			</apex:pageBlockTable> 
			 <apex:pageBlockTable value="{!allthequotas}" var="key3">
			<apex:column headerValue="Check">
			    <apex:inputCheckbox id="checkbox" styleClass="checkbox3"/>
			</apex:column>
				<apex:column headerValue="Name">
				    <apex:outputField value="{!key3.QuotaOwnerId}"/>
				</apex:column>
    			  <apex:column headerValue="Quota">
			    	<apex:inputField value="{!key3.QuotaAmount}" required="false"/>
			    </apex:column> 
			</apex:pageBlockTable> 
			 <apex:pageBlockTable value="{!allthequotas}" var="key4">
			<apex:column headerValue="Check">
			    <apex:inputCheckbox id="checkbox" styleClass="checkbox4"/>
			</apex:column>
				<apex:column headerValue="Name">
				    <apex:outputField value="{!key4.QuotaOwnerId}"/>
				</apex:column>
    			  <apex:column headerValue="Quota">
			    	<apex:inputField value="{!key4.QuotaAmount}" required="false"/>
			    </apex:column>
			</apex:pageBlockTable>
	</apex:pageBlockSection>
</apex:pageBlock>

Kind Regards
 
I want to copy a value of an inputField wich is checked and paste it to an other inputField. I can do it with Javascript like this :
function copy(test,test2) { document.getElementById(test2).value = document.getElementById(test).value; } <apex:inputText id="test" required="false"/> <apex:inputText id="test2" required="false"/>

It's work with a simple inputText but doesn't work with inputField on a PageBlockTable. If you have any ideas how to do it..
Regards
Jeremy
Hi SFDC, I'm new in the Apex world :)
I have some trouble with picklist value, i will explain.
I have a picklist that show me the StartDate from the Period Objects.
I have also a List of ForecastingQuota by User.
The problem is that when I select a value in the picklist, the controller doesn't get it, so my query wich show the user can't change.
Controller :
public List<SelectOption> optionspl {get;set;}
public List<User> resultsusers{get;set;}
public Date dateinput{get;set;}
public Date dateinput2 {get;set;}


public List<SelectOption> getPeriodList(){
 		List<SelectOption> optionspl = new List<SelectOption>();
 		List<SObject> resultspl = [SELECT FullyQualifiedLabel, StartDate FROM Period WHERE StartDate > TODAY AND Type = 'Quarter'];
 		for(SObject pl : resultspl){
 			optionspl.add(new SelectOption(String.valueOf(pl.get('StartDate')),String.valueOf(pl.get('StartDate'))));
 		}
 		return optionspl;
 	}

public  List<ForecastingQuota> getAllQuotas(){
		dateinput = Date.today();
		date mydate2 = mydate.addDays(90);

		List<ForecastingQuota> resultsquotas = new List<ForecastingQuota>();
	    resultsquotas = [SELECT Id,QuotaAmount,QuotaOwnerId, StartDate FROM ForecastingQuota WHERE StartDate >:dateinput AND StartDate <:mydate2 ORDER BY QuotaOwnerId, StartDate ASC];
	    
	    List<User> resultsusers = new List<User>();
		resultsusers = [SELECT Id FROM User WHERE IsActive = TRUE AND ForecastEnabled = TRUE LIMIT 999];

		Map<Id, ForecastingQuota> fqsByOwnerId = new Map<Id, ForecastingQuota>();
			for (ForecastingQuota fq : resultsquotas)
			{
			    fqsByOwnerId.put(fq.QuotaOwnerId, fq);
			}
		
			// new map of quotas keyed by all user ids
		Map<Id, ForecastingQuota> allUserFqsByOwnerId = new Map<Id, ForecastingQuota>();
			for (User u : resultsusers)
			{
			     allUserFqsByOwnerId.put(u.id, fqsByOwnerId.containsKey(u.id) ? fqsByOwnerId.get(u.id) : new ForecastingQuota(QuotaOwnerId = u.id, QuotaAmount = null));
			    	
			}
			List<ForecastingQuota> allthequotas = new List<ForecastingQuota>();
			allthequotas = allUserFqsByOwnerId.values();
			allthequotas.sort();
			return allthequotas;
	}

And the VFP code :
<apex:pageBlockSection columns="4">
<apex:selectList value="{!dateinput2}" id="dateinput2" size="1">
    <apex:selectOptions value="{!periodlist}" />
     <apex:actionSupport event="onchange" rerender="allquotas"/>
</apex:selectList>
			<apex:pageBlockTable value="{!allquotas}" var="key">
				<apex:column>
				<input type="checkbox" name="pouet"/>
				</apex:column>
				<apex:column headerValue="Name">
				    <apex:outputField  value="{!key.QuotaOwnerId}"/>
				</apex:column>
    			<apex:column headerValue="Quota">
			    	<apex:inputField value="{!key.QuotaAmount}"/>
			    </apex:column>
			    <apex:column headerValue="Date">
			    	<apex:outputField value="{!key.StartDate}"/>
			    </apex:column>
			</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>

Thank's for the help :)
 
Hi,
I have a List of User Id :
List<User> resultsusers = new List<User>();
		resultsusers = [SELECT Id FROM User WHERE IsActive = TRUE AND ForecastEnabled = TRUE];
And a List of ForecastingQuota :
List<ForecastingQuota> resultsquotas = new List<ForecastingQuota>();
	    resultsquotas = [SELECT Id,QuotaAmount,QuotaOwnerId FROM ForecastingQuota ORDER BY StartDate ASC];
And I want to put the Id of the User with the Id of the ForecastingQuota and also his QuotaAmount in a new List.

I don't know how to make it.

Thanks for  your reponses :)


 
Hi, I make a pageBlockTable of ForecastingQuota, but when I save it, nothing happen, my QuotaAmount want to be saved.
 VFP Code :
<apex:pageMessages />
	<apex:pageBlock title="All ForecastingQuotas" id="forecast_list" mode="inlineEdit" >
	<apex:PageBlockButtons >
	    <apex:commandButton action="{!save1}" value="save"/>
	</apex:PageBlockButtons>
            <apex:pageBlockTable value="{!loadquotas}" var="qs" id="aforecastlist">
            	<apex:column headerValue="Id">
            	<apex:outputField value="{!qs.Id}"/>
            	</apex:column>
            	<apex:column headerValue="QuotaAmount">
                <apex:outputField value="{!qs.QuotaAmount }"/>
				</apex:column>
                <apex:column headerValue="QuotaOwnerId">
                <apex:outputField value="{!qs.QuotaOwnerId}"/>
				</apex:column>
                <apex:column headerValue="StartDate">
                <apex:outputField value="{!qs.StartDate}"/>
				</apex:column>
                <apex:column headerValue="ForecastingTypeId">
                <apex:outputField value="{!qs.ForecastingTypeId}"/>
				</apex:column>
                <apex:column headerValue="IsAmount">
                <apex:outputField value="{!qs.IsAmount}"/>
				</apex:column>
                <apex:column headerValue="ProductFamily">
                <apex:outputField value="{!qs.ProductFamily}"/>
				</apex:column>
                <apex:column headerValue="QuotaQuantity">
                <apex:outputField value="{!qs.QuotaQuantity}"/>
				</apex:column>
                <apex:column headerValue="PeriodId">
				<apex:outputField value="{!qs.PeriodId}"/>
				</apex:column>
		 		
				<!-- <apex:inlineEditSupport event="ondblClick"/> -->
			</apex:pageBlockTable>
	</apex:pageBlock>

Apex :
public List<ForecastingQuota> getLoadQuotas() {
		    List<ForecastingQuota> resultsquotas = new List<ForecastingQuota>();
		    resultsquotas = [SELECT Id,CurrencyIsoCode, ForecastingTypeId, IsAmount, IsQuantity, PeriodId,ProductFamily,QuotaAmount,StartDate,QuotaQuantity,QuotaOwnerId FROM ForecastingQuota ORDER BY QuotaAmount DESC];
		    return resultsquotas;
		}

public void save1() {
	    	List<ForecastingQuota> resultsquotas = new List<ForecastingQuota>();
		    resultsquotas = [SELECT Id,CurrencyIsoCode, ForecastingTypeId, IsAmount, IsQuantity, PeriodId,ProductFamily,QuotaAmount,StartDate,QuotaQuantity,QuotaOwnerId FROM ForecastingQuota];
		    
     		update resultsquotas;
     		System.debug(resultsquotas);
		}
Thanks for your help
 
Hi,

I'm trying to make a visualforce page to show/edit all Quotas with the name of the user associated with the Quotas.


Thak's a lot
Hello,
I have a table with multiple rows, and a selectoptions for each row.
When I have only one row, I can get the value (fol.Type__c = typeOfOpp;) in my controller, but if there is many rows, the value is "none".

Apex Code : 
public String typeOfOpp{get;set;}

public List<SelectOption> loadFastType(){
		fastType = new List<SelectOption>();
		fastType.add(new SelectOption('none', '-- Select Type --'));
		fastType.add(new SelectOption('Optimist', 'Optimist'));
		fastType.add(new SelectOption('Forecast Exit', 'Forecast Exit'));
		fastType.add(new SelectOption('Pessimist', 'Pessimist'));
		return fastType;
	}

public void saveValue(){
		List<FAST_OPP__c> fastOppListToSave = new List<FAST_OPP__c>();
		for(FAST_OPP__c fol : fastOppList){
			fol.Opp_ID__r = null;
			fol.Type__c = typeOfOpp;
			fastOppListToSave.add(fol);
		}
		try {
			//upsert fastOppList;
			upsert fastOppListToSave;
		} catch (exception ex) {
			System.debug(ex);
		}
	}


Kind regards
Hello guys,
I've got some problem with my save method, nothing happen, even the System.debug is not launch on the Debug Log;
Thanks for your help
Here my VFP and Controller code : 
public with sharing class ManageFAST {

	public List<SelectOption> 							quarterList {get;set;}
	public List<SelectOption> 							fastType{get;set;}
	public Map<Id, FAST__c>								mapFast{get;set;}
	public FAST__c 										fast{get;set;}
	public List<FAST_OPP__c> 							fastOppList{get;set;}
	//public List<AggregateResult> 						fastOppListSum{get;set;}

	public String 										typeOfOpp{get;set;}
	public Decimal 										sumOfAmount{get;set;}

	//public List<FAST__c> 								fastList{get;set;}

	private List<ManageOpp>								manageOppList{get;set;}
	private manageUser 									oppUser;
	private ManageOpp 									oppOpp;
	public Date 										quarter{get;set;}
	public String 										selectedQuarter {get;set;}
	public Date 										selectedQuarterReturn{get;set;}
	public Date 										testdate{get;set;}



	public ManageFAST() {
		fast = new FAST__c();
		//fastList = new List<FAST__c>();
		fastOppList = new List<FAST_OPP__c>();
		oppUser = new ManageUser();
		oppOpp = new ManageOpp();

		oppUser.load(UserInfo.getUserId());
		quarter = Date.today();
		quarterList = loadQuarterList();
		loadFastType();
		loadFAST();
		loadFASTOPP();
		initFASTOppList();
	}


	public List<SelectOption> loadFastType(){
		fastType = new List<SelectOption>();
		fastType.add(new SelectOption('none', '-- Select Type --'));
		fastType.add(new SelectOption('Optimist', 'Optimist'));
		fastType.add(new SelectOption('Forecast Exit', 'Forecast Exit'));
		fastType.add(new SelectOption('Pessimist', 'Pessimist'));
		return fastType;
	}

	public List<SelectOption> loadQuarterList() {
		List<SelectOption> optionsquarter = new List<SelectOption>();
		List<Period> resultsquarter = [SELECT EndDate, FullyQualifiedLabel, StartDate, Type
		FROM Period 
		WHERE Type = 'Quarter' AND StartDate >= LAST_YEAR];
		for(Period rq : resultsquarter){
		optionsquarter.add(new SelectOption(String.valueOf(rq.get('StartDate')),String.valueOf(rq.get('FullyQualifiedLabel'))));
		
		}
		return optionsquarter;
	}


	public void loadFAST(){
		if(selectedQuarterReturn == null){
			selectedQuarterReturn = Date.today();
		} else {
			selectedQuarterReturn = Date.valueOf(selectedQuarter);
		}
		List<FAST__c> fastList = new List<FAST__c>();
		fastList = [SELECT Id, Sales_ID__c, Forecast_Manager_ID__c, Quarter_Date__c, Commit_Manager__c, Transactionnal_Amount_Forecast_Exit__c, 
					Transactionnal_Amount_Optimistic__c, Transactionnal_Amount_Pessimistic__c,Opp_Amount_Optimist__c,
					Opp_Amount_Forecast_Exit__c, Opp_Amount_Pessimist__c
					FROM FAST__c 
					WHERE Sales_ID__c =: oppUser.getId()
					//AND Quarter_Date__c >=:selectedQuarterReturn 
					//LIMIT 1
					];

		if(fastList.isEmpty()){
			fast = new FAST__c();
			fast.Sales_ID__c = oppUser.getId();
			fast.Forecast_Manager_ID__c = oppUser.getManagerId();
			fast.Transactionnal_Amount_Pessimistic__c = 0;
			fast.Transactionnal_Amount_Optimistic__c = 0;
			fast.Transactionnal_Amount_Forecast_Exit__c = 0;
			//fast.Quarter_Date__c =:selectedQuarterReturn
			fast.Opp_Amount_Pessimist__c = 0;
			fast.Opp_Amount_Optimist__c = 0;
			fast.Opp_Amount_Forecast_Exit__c = 0;
			fast.Commit_Manager__c = 0;
		} else {
			fast = fastList.get(0);
		}
	}


	public void loadFASTOPP(){

		Date selectedQuarterReturn = Date.valueOf(quarterList.get(0).getValue());
		Date selectedQuarterReturnNext = Date.valueOf(quarterList.get(1).getValue());
	
			if(selectedQuarter == null){
				selectedQuarterReturn = Date.today();
			} else {
				selectedQuarterReturn = Date.valueOf(quarterList.get(0).getValue());

			}
			//System.debug(selectedQuarterReturn);
			//System.debug(selectedQuarterReturnNext);
	
			fastOppList = [SELECT Id, Opp_ID__c, IsClosed__c, Type__c, Opp_Amount__c, FAST_ID__c
			FROM FAST_OPP__c 
			WHERE IsClosed__c != true
			AND Opp_ID__r.CloseDate >=: selectedQuarterReturn
			];		
	}

	public void initFASTOppList(){
		oppUser.loadOpportunityList(quarter);
		for(ManageOpp mo : oppUser.getOpportunityList())
		{

			Map<Id, FAST_OPP__c> testMap = new Map<Id, FAST_OPP__c>();
			for(FAST_OPP__c fo : fastOppList){
				testMap.put(fo.Opp_ID__c, fo);
				//System.debug('1er test MO' + fastOppList);
			}

			if(!testMap.containsKey(mo.getOppId())){
				FAST_OPP__c fastOpp = new FAST_OPP__c();
				fastOpp.Opp_ID__c = mo.getOppId();
				fastOpp.FAST_ID__c = fast.Id;
				fastOpp.IsClosed__c = mo.getIsClosed();
				fastOpp.Opp_ID__r = new Opportunity();
				fastOpp.Opp_ID__r.Amount = mo.getAmount();
				fastOpp.Type__c = 'none';
				fastOppList.add(fastOpp);
			}
		}
	}


	public FAST__c getFAST(){
		return this.fast;
	}
public PageReference goSave() {
		System.debug('fastOppList before for = ' + fastOppList);

		List<FAST_OPP__c> fastOppListToSave = new List<FAST_OPP__c>();
		
		for(FAST_OPP__c fol : fastOppList){
			System.debug('fastOppList a the begining of the for' + fastOppList);
			fol.Opp_ID__r = null;
			//if(fol.Type__c == null){
				//fol.Type__c = typetype;
				fol.Type__c = this.typeOfOpp;
			//}
			//fol.Type__c = typetype;
			System.debug('fastOppListToSave before the add' + fastOppListToSave);
			fastOppListToSave.add(fol);
			System.debug('fastOppListToSave during for' + fastOppListToSave);
			//if(fol.Type__c != 'none'){
			//	fastOppListToSave.add(fol);
			//	System.debug('fastOppListToSave during SAVE' + fastOppListToSave);
			//}
		}
			System.debug('fastOppListToSave after for' + fastOppListToSave);

		try {
			System.debug('fastOppListToSave during save' + fastOppListToSave);
			upsert fastOppListToSave;
		} catch (exception ex) {
			System.debug(ex);
		}
		return null;
	}
 
<apex:page showHeader="true" sidebar="true" controller="ManageFAST" >

<apex:includeScript value="{!URLFOR($Resource.jquery, '/jquery-ui-1.10.3.custom/js/jquery-1.9.1.js')}" />
<apex:includeScript value="{!URLFOR($Resource.jquery, '/jquery-ui-1.10.3.custom/js/jquery-ui-1.10.3.custom.min.js')}" />





<apex:form id="formId">
<script type="text/javascript">
			$j = jQuery.noConflict();

			$j(document).ready(function() {
					var total = 0;
					$j('.optimist').each(function(){
						var t = $j(this).parent().parent().find('.optimist').val();
						total += parseFloat(t); 
					});
					$j('.grandTotal').val(total);

					$j('.type_opp').change(function(){			
					var opp_amount = $j(this).parent().parent().find('.amount_to_copy').text();

						if($j(this).parent().parent().find('.type_opp').val() == 'Pessimist'){
							$j(this).parent().parent().find('.pessimist').val(opp_amount);
							$j(this).parent().parent().find('.forecast_exit').val(opp_amount);
							$j(this).parent().parent().find('.optimist').val(opp_amount);

						} else if ($j(this).parent().parent().find('.type_opp').val() == 'Forecast Exit'){
							$j(this).parent().parent().find('.pessimist').val('');
							$j(this).parent().parent().find('.forecast_exit').val(opp_amount);
							$j(this).parent().parent().find('.optimist').val(opp_amount);

						} else if ($j(this).parent().parent().find('.type_opp').val() == 'Optimist'){
							$j(this).parent().parent().find('.pessimist').val('');
							$j(this).parent().parent().find('.forecast_exit').val('');
							$j(this).parent().parent().find('.optimist').val(opp_amount);
						}
				});
			});
		</script>


<br/><br/>
<apex:selectList value="{!selectedQuarter}"  size="1">
	<apex:selectOptions value="{!QuarterList}" />
	<apex:actionSupport event="onchange" action="{!loadFASTOPP}" reRender="formId"/>
</apex:selectList>
<br/><br/>
<apex:outputText value="{!selectedQuarterReturn}"></apex:outputText>

<apex:pageBlock>
	<apex:pageBlockTable value="{!fastOppList}" id="table" var="f" >
				<apex:column headerValue="Opportunity Name" value="{!f.Opp_ID__c}"/>
				<!-- <apex:column headerValue="Opportunity Account" value="{!f.Opp_ID__r.Account.Name}"/> -->
				<apex:column headerValue="Amount" styleClass="amount_to_copy" value="{!f.Opp_Amount__c}"/>
				<apex:column headerValue="Type">
					<apex:selectList styleClass="type_opp" value="{!typeOfOpp}"  size="1">
						<apex:selectOptions value="{!fastType}" />
					</apex:selectList>
				</apex:column>

				<apex:column headerValue="TYpe" value="{!f.Type__c}">
				</apex:column>

				<apex:column headerValue="Total Pessimistic">
				<apex:inputText styleClass="pessimist" value="{!f.Opp_Amount__c}"/>
				</apex:column>

				<apex:column headerValue="Total Forecast Exit">
				<apex:inputText styleClass="forecast_exit" value="{!f.Opp_Amount__c}"/>
				</apex:column>

				<apex:column headerValue="Total Optimistic">
				<apex:inputText styleClass="optimist" value="{!f.Opp_Amount__c}"/>
				</apex:column>
				<apex:column headerValue="Is closed ?">
				<apex:outputText value="{!f.IsClosed__c}"/>
				</apex:column>
	</apex:pageBlockTable>
</apex:pageBlock>
	
<apex:pageBlock>
		<apex:outputText>Commit Manager </apex:outputText>
		<apex:inputText value="{!sumOfAmount}" styleClass="grandTotal"/>
</apex:pageBlock>

<apex:commandButton value="Save Value" action="{!saveValue}"/>
<apex:commandButton value="SaveMoi" action="{!saveMoi}"/>
<apex:commandButton value="GoSave" action="{!goSave}"/>
<apex:commandButton value="TEST" action="{!testTest}"/>

<br/>

</apex:form>



</apex:page>

Thanks
Hello Dev Community,
I'm making an new app, named FAST.
I have two Objects : FAST and FAST_OPP. In FAST_OPP, there are informations about Opportunity, and in FAST there are other data link with FAST_OPP.
When I update FAST_OPP, I want to push also data in FAST. But I need to create ID in FAST during the upsert and I don't know how to do this.
Here's my controller code and visualforce :
 
public with sharing class ManageFAST {

	public List<SelectOption> 							quarterList {get;set;}
	public List<SelectOption> 							fastType{get;set;}

	public FAST__c 										fast{get;set;}
	public List<FAST_OPP__c> 							fastOppList{get;set;}
	private List<ManageOpp>								manageOppList{get;set;}
	private manageUser 									oppUser;
	private ManageOpp 									oppOpp;
	public Date 										quarter;
	public String 										selectedQuarter {get;set;}
	public Date 										selectedQuarterReturn{get;set;}
	public Date 										testdate{get;set;}

	public ManageFAST() {
		fast = new FAST__c();
		fastOppList = new List<FAST_OPP__c>();
		oppUser = new ManageUser();
		oppOpp = new ManageOpp();
		oppUser.load(UserInfo.getUserId());
		quarter = Date.today();
		quarterList = loadQuarterList();
		loadFastType();
		loadFAST();
		loadFASTOPP();
		initFASTOppList();
	}


	public void loadFAST(){
		List<FAST__c> fastList = new List<FAST__c>();
		fastList = [SELECT Id, Sales_ID__c, Forecast_Manager_ID__c, Quarter_Date__c, Commit_Manager__c, Transactionnal_Amount_Forecast_Exit__c, 
					Transactionnal_Amount_Optimistic__c, Transactionnal_Amount_Pessimistic__c,Opp_Amount_Optimist__c,
					Opp_Amount_Forecast_Exit__c, Opp_Amount_Pessimist__c
					FROM FAST__c 
					WHERE Sales_ID__c =: oppUser.getId()
					//AND Quarter_Date__c >=:selectedQuarterReturn 
					LIMIT 1
					];

		if(fastList.isEmpty()){
			fast = new FAST__c();
			fast.Sales_ID__c = oppUser.getId();
			fast.Transactionnal_Amount_Pessimistic__c = 0;
			fast.Transactionnal_Amount_Optimistic__c = 0;
			fast.Transactionnal_Amount_Forecast_Exit__c = 0;
			fast.Opp_Amount_Pessimist__c = 0;
			fast.Opp_Amount_Optimist__c = 0;
			fast.Opp_Amount_Forecast_Exit__c = 0;
			fast.Commit_Manager__c = 0;
		} else {
			fast = fastList.get(0);
		}
	}


	public void loadFASTOPP(){
			//selectedQuarterReturn = Date.valueOf(selectedQuarter);
			fastOppList = [SELECT Id, Opp_ID__c, IsClosed__c, Type__c, Opp_Amount__c, Opp_ID__r.Amount , Opp_ID__r.Account.Name, 
			FAST_ID__r.Transactionnal_Amount_Forecast_Exit__c,FAST_ID__r.Transactionnal_Amount_Pessimistic__c,
			FAST_ID__r.Transactionnal_Amount_Optimistic__c , FAST_ID__r.Opp_Amount_Pessimist__c, FAST_ID__r.Opp_Amount_Forecast_Exit__c ,
			FAST_ID__r.Opp_Amount_Optimist__c, FAST_ID__r.Id
			FROM FAST_OPP__c 
			WHERE IsClosed__c != true
			//WHERE FAST_ID__c =: fast.Id
			//AND FAST_ID__r.Sales_ID__c =: oppUser.getId()
			//AND FAST_ID__r.Quarter_Date__c >=: selectedQuarterReturn
			];
	}

	public void initFASTOppList(){
		oppUser.loadOpportunityList(quarter);
		for(ManageOpp mo : oppUser.getOpportunityList())
		{

			Map<Id, FAST_OPP__c> testMap = new Map<Id, FAST_OPP__c>();
			for(FAST_OPP__c fo : fastOppList){
				//System.debug('fastOppList before init' + fastOppList);

				testMap.put(fo.Opp_ID__c, fo);
				System.debug('testMap' + testMap);

				//System.debug('fastOppList after init' + fastOppList);

			}

			if(!testMap.containsKey(mo.getOppId())){
				FAST_OPP__c fastOpp = new FAST_OPP__c();
				fastOpp.Opp_ID__c = mo.getOppId();
				//fastOpp.FAST_ID__c = fast.Id;
				fastOpp.IsClosed__c = mo.getIsClosed();
				fastOpp.Type__c = 'none';
				//fastOpp.FAST_ID__r.Sales_ID__c = oppUser.getId();
				fastOppList.add(fastOpp);
				System.debug('FAST OPP LIST IN INIT AFTER ADD' + fastOppList);

			}
			//System.debug('FIRST USER DEBUG BEFORE ADD TO FAST_OPP__c' + fastOppList);
		}

		//System.debug('TEST FASTOPPLIST' + fastOppList.size());



	}


	public List<SelectOption> loadFastType(){
		fastType = new List<SelectOption>();
		fastType.add(new SelectOption('none', '-- Select Type --'));
		fastType.add(new SelectOption('Optimist', 'Optimist'));
		fastType.add(new SelectOption('Forecast Exit', 'Forecast Exit'));
		fastType.add(new SelectOption('Pessimist', 'Pessimist'));
		return fastType;
	}

	public void assignTypeCopyValue(){

	}



	public List<SelectOption> loadQuarterList() {
		List<SelectOption> optionsquarter = new List<SelectOption>();
		List<Period> resultsquarter = [SELECT EndDate, FullyQualifiedLabel, StartDate, Type
		FROM Period 
		WHERE Type = 'Quarter' AND StartDate >= LAST_YEAR];
		for(Period rq : resultsquarter){
		optionsquarter.add(new SelectOption(String.valueOf(rq.get('StartDate')),String.valueOf(rq.get('FullyQualifiedLabel'))));
		selectedQuarterReturn = Date.valueOf(rq.get('StartDate'));
		}
		//System.debug('selectedQuarterReturn' + selectedQuarterReturn);

		return optionsquarter;
	}





	public FAST__c getFAST(){
		return this.fast;
	}


	public PageReference goSave() {
		List<FAST_OPP__c> fastOppListToSave = new List<FAST_OPP__c>();
		for(FAST_OPP__c fol : fastOppList){
			System.debug('fastOppList during SAVE' + fastOppList);

			//fol.FAST_ID__c = fast.Id; // il est null la
			//fol.FAST_ID__r.Sales_ID__c = oppUser.getId();

			//System.debug('TEST fastOppListToSave' + fol.FAST_ID__c);

			if(fol.Type__c != 'none'){
				fastOppListToSave.add(fol);
				System.debug('fastOppListToSave during SAVE' + fastOppListToSave);
				//System.debug('SALES ID' + fol.FAST_ID__r.Sales_ID__c);
				//System.debug('TEST fastOppListToSave' + fastOppListToSave.size());

			}
		}
		try {
			upsert fastOppListToSave;
		} catch (exception ex) {
			System.debug(ex);
		}

		return null;
	}




}
 
<apex:page showHeader="true" sidebar="true" controller="ManageFAST" >

<apex:includeScript value="{!URLFOR($Resource.jquery, '/jquery-ui-1.10.3.custom/js/jquery-1.9.1.js')}" />
<apex:includeScript value="{!URLFOR($Resource.jquery, '/jquery-ui-1.10.3.custom/js/jquery-ui-1.10.3.custom.min.js')}" />

<apex:slds />

<div class="slds-scope">

<apex:form id="formId">

<script type="text/javascript">
			$j = jQuery.noConflict();
			
			function saveComplete() {
				window.location.reload(true);
			}
	
			function testalert(){
				alert('test alert button change typelist in top');
				console.log('test');
			};

			$j(document).ready(function() {
				console.log('Test lancement JQUERY');

					$j('.type_opp').change(function(){			
					var opp_amount = $j(this).parent().parent().find('.amount_to_copy').text();

						if($j(this).parent().parent().find('.type_opp').val() == 'Pessimist'){
							$j(this).parent().parent().find('.pessimist').val(opp_amount);
							$j(this).parent().parent().find('.forecast_exit').val(opp_amount);
							$j(this).parent().parent().find('.optimist').val(opp_amount);
							console.log('change amount to pessimist');

						} else if ($j(this).parent().parent().find('.type_opp').val() == 'Forecast Exit'){
							$j(this).parent().parent().find('.pessimist').val('');
							$j(this).parent().parent().find('.forecast_exit').val(opp_amount);
							$j(this).parent().parent().find('.optimist').val(opp_amount);
							console.log('change amount to optimist');

						} else if ($j(this).parent().parent().find('.type_opp').val() == 'Optimist'){
							$j(this).parent().parent().find('.pessimist').val('');
							$j(this).parent().parent().find('.forecast_exit').val('');
							$j(this).parent().parent().find('.optimist').val(opp_amount);
							console.log('change amount to pessimist');
						}
				});
			});
		</script>

<br/><br/>
<apex:selectList value="{!selectedQuarter}"  size="1">
	<apex:selectOptions value="{!QuarterList}" />
	<apex:actionSupport event="onchange" action="{!loadFASTOPP}" reRender="formId"/>
</apex:selectList>
<br/><br/>


<apex:pageBlock>
	<apex:pageBlockTable styleClass="slds-table slds-table--bordered slds-table--cell-buffer" value="{!fastOppList}" id="table" var="f" >
				<apex:column headerValue="Opportunity Name" value="{!f.Opp_ID__c}"/>
				<apex:column headerValue="Opportunity Account" value="{!f.Opp_ID__r.Account.Name}"/>
				<apex:column headerValue="Amount" styleClass="amount_to_copy" value="{!f.Opp_Amount__c}"/>
				<apex:column headerValue="Type">
					<apex:selectList styleClass="type_opp"  value="{!f.Type__c}"  size="1">
						<apex:selectOptions value="{!fastType}" />
					</apex:selectList>
				</apex:column>
				
				<apex:column headerValue="Total Pessimistic">
				<apex:inputText styleClass="pessimist" value="{!f.FAST_ID__r.Opp_Amount_Pessimist__c}"/>
				</apex:column>

				<apex:column headerValue="Total Forecast Exit">
				<apex:inputText styleClass="forecast_exit" value="{!f.FAST_ID__r.Opp_Amount_Forecast_Exit__c}"/>
				</apex:column>

				<apex:column headerValue="Total Optimistic">
				<apex:inputText styleClass="optimist" value="{!f.FAST_ID__r.Opp_Amount_Optimist__c}"/>
				</apex:column>
				<apex:column headerValue="Is closed ?">
				<apex:inputText styleClass="slds-input" value="{!f.IsClosed__c}"/>
				</apex:column>
				<apex:column headerValue="Id du FAST" value="{!f.FAST_ID__r.Id}"/>
				<apex:column headerValue="Id du FAST OPP" value="{!f.Id}"/>


	</apex:pageBlockTable>
</apex:pageBlock>

<apex:commandButton styleClass="slds-button--selected" value="Save" action="{!goSave}" oncomplete="saveComplete()" reRender="formId"></apex:commandButton>
<br/>
<apex:commandButton styleClass="slds-button--selected" value="TEST loadFAST" action="{!loadFAST}" oncomplete="saveComplete()" reRender="formId"></apex:commandButton>


<apex:pageBlock>
<apex:pageBlockTable styleClass="slds-table slds-table--bordered slds-table--cell-buffer" value="{!fast}" var="fr" >
				<apex:column headerValue="Opportunity Name" value="{!fr.Sales_ID__c}"/>
				
			</apex:pageBlockTable>
		</apex:pageBlock>



</apex:form>
</div>



</apex:page>

I want to copy the value stored in the visualforce table into FAST and FAST_OPP.

Best Regards,
Jeremy
 
Hello everyone,

I've got a Classe named 'ManageUser". In this class, a method extract all opportunities for users.
I've got an other Class named 'ManageFAST". In this class, I need to copy the values of the Opportunity List.
And I don't know how to do it.
Here is my code.

ManageUser : 
public Boolean loadOpportunityList(Date quarter){
		String query = ManageOpp.OPP_QUERY;
		query += ' WHERE Owner.Id =: id';
		if(quarter != null){
			query += ' AND CloseDate >=: quarter';
		}
		List<Opportunity> oppList = Database.query(query);
		if(oppList.isEmpty()){
			return false;
		}
		myOppList = new List<ManageOpp>();
		for(Opportunity opp : oppList){
			myOppList.add(new ManageOpp(opp));
		}
		return true;
	}


	public Boolean loadOpportunityList(){
		return loadOpportunityList(null);
	}

public List<ManageOpp> getOpportunityList(){
		return this.myOppList;
	}

ManageFAST : 
public List<FAST__c> 						fast{get;set;}
	private List<FAST_OPP__c> 					fastOppList;
	private List<ManageOpp>						manageOppList{get;set;}
	private manageUser 							oppUser;
	public Date 								quarter;

public ManageFAST() {
		fast = new List<FAST__c>();
		oppUser = new ManageUser();
	}

	public void loadFAST(){
		List<FAST__c> fast = new List<FAST__c>();
		fast = [SELECT Id, Sales_ID__c, Forecast_Manager_ID__c, Quarter_Date__c, Commit_Manager__c, Transactionnal_Amount_Forecast_Exit__c, Transactionnal_Amount_Optimistic__c, Transactionnal_Amount_Pessimistic__c FROM FAST__c];
	}

public void initFASTOppList(){
		oppUser.load(UserInfo.getUserId());
		//quarter = Date.newInstance(1960, 2, 17);
		oppUser.loadOpportunityList(quarter);
		

		for(FAST_OPP__c fo : oppUser.getOpportunityList())
		{
		}
 





	}

Thanks
Hi everyone

I'm witting one of my first Visualforces.This one:
<apex:page Controller="ScenariosController">
    <apex:pageMessages ></apex:pageMessages>
    <apex:pageBlock >
    
        <apex:pageBlockTable value="{!}" var="item" >
    
             <apex:column value="{!item.Scenario__c}"                 style="background-color:{!If(item.CHK_Scenario_Principal__c ==True,'#beecf4', '')}"/>
            <apex:column value="{!item.PCK_Tower_Height__c}"         style="background-color:{!If(item.CHK_Scenario_Principal__c ==True,'#beecf4', '')}" />
            <apex:column value="{!item.NUM_Quantity__c}"             style="background-color:{!If(item.CHK_Scenario_Principal__c ==True,'#beecf4', '')}" />
            <apex:column value="{!item.CHK_Scenario_Principal__c}"   style="background-color:{!If(item.CHK_Scenario_Principal__c ==True,'#beecf4', '')}"/>
            <!-- background-color:{!If(opp.StageName =='Negotiation/Review','#7CFC00',If(opp.StageName =='Closed Won','#DEB887','#DC143C'))}; -->
    
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:page>


And this controller:
 
public class ScenariosController{
      
    List<Quote_line__c> quoteLineList;
    
    //Populate a list with all the quote Lines != NULL ordered by NUM_Scenario__c DESC
    public List<Quote_line__c> getQuoteLineItems(){
       Id budgetId= ApexPages.currentPage().getParameters().get('Id');
       if (budgetId!= NULL){
           List<Quote_line__c> quoteLineList = new List<Quote_line__c>();
           quoteLineList = [SELECT id,name,lkp_product__r.family__c, lkp_product__r.Nominal_Power_MW__c, CHK_Included__c,
                                        NUM_Cost__c,LKP_Configurator__c,Sum_mandatory_fields_for_budReq_unfill__C,Date_from__c,Date_to__c,
                                        TXT_Tower_First_Value__c, NUM_Quantity__c,LKP_Product__c,MD_quote__c, NUM_Scenario__c, CHK_Scenario_Principal__c
                             FROM quote_line__c 
                             WHERE NUM_Scenario__c != NULL
                             ORDER BY NUM_Scenario__c
                             DESC];
                           }
        return quoteLineList;
    }
}



I don't know how to continue. What I know is, I have to define the get method to pass data from the controller to the Visualforce but no idea about where and how to put it.

Thanks in advance for your time!
Cheers!
Alberto
Hello SFDC Dev,

I have a pageblock table that's show Quotas of Sales.
I have a picklist (this picklist works) of user role, and the rerender work for the table.
But when I put a picklist of Date, nothing happens for the table and the value of the picklist is not send to the controller.
Some code :
<apex:outputlabel value="User Role"/>
	<apex:selectList value="{!idofuserrole}"  size="1">
	<apex:actionSupport event="onchange" action="{!searchQuotas}" reRender="allquotas"/>
	<apex:selectOptions value="{!userrole}"  />
	</apex:selectList>

		<apex:outputlabel value="Quarter"/>
	<apex:selectList value="{!namequarter}"  size="1">
	<apex:actionSupport event="onchange" action="{!searchQuotas}" reRender="allquotas"/>
	<apex:selectOptions value="{!QuarterList}" />
	</apex:selectList>
	
	<apex:pageBlockTable value="{!allthequotas}" id="table" var="key" title="{!namequarter}">
	<apex:facet name="header">
	
	<input type="checkbox" id="checkAllBox" onchange="toggleCheckAll(this)"/> Select Quarter 
	</apex:facet>
	<apex:column>
	<input type="checkbox" data-inputid="val1"/>
	</apex:column>
	<apex:column headerValue="Name">
	<apex:outputField  value="{!key.QuotaOwnerId}"/>
	</apex:column>
	<apex:column headerValue="Quota">
	<apex:inputField value="{!key.QuotaAmount}" required="false" id="val1"/>
	</apex:column>
	<apex:column headerValue="Quota">
	<apex:inputField value="{!key.StartDate}" required="false"/>
	</apex:column>
	</apex:pageBlockTable>
	
	
	public Date namequarter{get{
		if(namequarter == null){
		namequarter = Date.today();

	}return namequarter;
	}
	set;
}

	
	public List<SelectOption> getQuarterList(){
	List<SelectOption> optionsquarter = new List<SelectOption>();
	List<SObject> resultsquarter = [SELECT FullyQualifiedLabel,EndDate,StartDate,Type
	FROM Period
	WHERE Type = 'Quarter'
	AND StartDate >= TODAY];
	for(SObject rq : resultsquarter){
		optionsquarter.add(new SelectOption(String.valueOf(rq.get('StartDate')),String.valueOf(rq.get('StartDate'))));
	}
	return optionsquarter;
}
Thanks for your responses.

 
Hello,

I have a VF page which is available to sustem admin but not available in to user in "partner portal",i have given access to profiles to this page, is there something i am missing.. ?
Hi SF Dev,

I have a PageBlockTable that return the users with their related quotas in a <apex:inputField.
All I want is to save it when I change the amount of the quota, but when I click on save, nothing happen, the page is refreshing with the old data on the table.

Here is my apex code :
public with sharing class AssignQuotaTest {

public List<ForecastingQuota> resultsquotas{get;set;}
public List<ForecastingQuota> resultsquotas2{get;set;}
public List<ForecastingQuota> allthequotas{get;set;}
public List<USer> resultsusers{get;set;}

public Map<Id, ForecastingQuota> allUserFqsByOwnerId {get;set;}
public Map<Id, ForecastingQuota> fqsByOwnerId {get;set;}

public String QuotaAmount{get;set;}
public Id QuotaOwnerId{get;set;}
public String QuotaQuantity{get;set;}
public Id PeriodId{get;set;}
public String ProductFamily{get;set;}
public Boolean IsQuantity{get;set;}
public String CurrencyIsoCode{get;set;}
public Id ForecastingTypeId{get;set;}
public Boolean IsAmount{get;set;}


public Date dateperiod{get;set;}
public Date dateperiodlist {get;set;}
public Date dateperiodlist1 {get;set;}
public Date datetest {get;set;}

public String testquarter {get;set;}
public Date countryOptions {get;set;}
public Date theperiodlist {get;set;}
public Date theperiodlist2 {get;set;}

public String next{get;set;}
public String previous{get;set;}
public Date namequarter{get;set;}

public Date namequarter2{get;set;}

public String assignquotaamount {get;set;}

public Id idofuserrole{get;set;}
public Id idofuserrole1{get;set;}
public Id idofuserrole2{get;set;}

public Boolean usertype {get;set;}
public Boolean usertype2 {get;set;}
public Boolean usertypetest {get;set;}

public string testtest2{get;set;}
public string testtest{get;set;}

public Boolean changeuser{get;set;}




public AssignQuotaTest(ApexPages.StandardController controller) {

	    searchQuotas();
	}
	
	public void searchQuotas(){
		System.debug(changeuser);
		if(namequarter == null) {
			namequarter = Date.today();
		}

		if(next == 'next'){
			namequarter = namequarter.addDays(90);
		}  


		if(previous == 'previous'){
			namequarter = namequarter.addDays(-90);
		} 

		namequarter2 = namequarter.addDays(90);
		
		if(theperiodlist == null){
			theperiodlist = Date.today();
		}

		theperiodlist2 = theperiodlist.addDays(90);
		


		List<ForecastingQuota> resultsquotas = new List<ForecastingQuota>();
	    resultsquotas = [SELECT Id,QuotaAmount,QuotaOwnerId, StartDate FROM ForecastingQuota WHERE StartDate >=:namequarter AND StartDate <=:namequarter2 ORDER BY QuotaOwnerId ASC];
	    List<User> resultsusers = new List<User>();
	    if(idofuserrole != null){
	    		resultsusers = [SELECT Id FROM User WHERE IsActive =:changeuser AND ForecastEnabled = TRUE AND UserRoleId =:idofuserrole];
	    	} else {
				resultsusers = [SELECT Id FROM User WHERE IsActive =:changeuser AND ForecastEnabled = TRUE];
			}
			
		Map<Id, ForecastingQuota> fqsByOwnerId = new Map<Id, ForecastingQuota>();
			for (ForecastingQuota fq : resultsquotas)
			{
			    fqsByOwnerId.put(fq.QuotaOwnerId, fq);
			}
		
			// new map of quotas keyed by all user ids
		Map<Id, ForecastingQuota> allUserFqsByOwnerId = new Map<Id, ForecastingQuota>();
			for (User u : resultsusers)
			{
			     allUserFqsByOwnerId.put(u.id, fqsByOwnerId.containsKey(u.id) ? fqsByOwnerId.get(u.id) : new ForecastingQuota(QuotaOwnerId = u.id, QuotaAmount = null));
			    	
			}
			allthequotas = new List<ForecastingQuota>();
			allthequotas = allUserFqsByOwnerId.values();
			allthequotas.sort();
	}



	public List<SelectOption> getQuarterDate() {
	        List<SelectOption> countryOptions = new List<SelectOption>();
	        countryOptions.add(new SelectOption('','-None-'));
	        countryOptions.add(new SelectOption('12/01/2016','Q4 2016'));
	        countryOptions.add(new SelectOption('01/01/2017','Q1 2017'));
	        countryOptions.add(new SelectOption('04/01/2017','Q2 2017'));
	        countryOptions.add(new SelectOption('07/01/2017','Q3 2017'));

	 
	        return countryOptions;
	}

 	public List<SelectOption> getPeriodList(){
 		List<SelectOption> optionspl = new List<SelectOption>();
 		List<SObject> resultspl = [SELECT FullyQualifiedLabel,EndDate,IsForecastPeriod,StartDate
									FROM Period
									WHERE EndDate > TODAY
									AND Type != 'Year'
									AND IsForecastPeriod = true
									ORDER BY EndDate ASC];
 		for(SObject pl : resultspl){
 			optionspl.add(new SelectOption(String.valueOf(pl.get('StartDate')),String.valueOf(pl.get('FullyQualifiedLabel'))));
 		}
 		return optionspl;
 	}


  	public List<SelectOption> getQuarterList(){
  		List<SelectOption> optionsquarter = new List<SelectOption>();
  		List<SObject> resultsquarter = [SELECT FullyQualifiedLabel,EndDate,StartDate,Type
										FROM Period
										WHERE Type = 'Quarter'
										AND StartDate >= TODAY];
		for(SObject rq : resultsquarter){
			optionsquarter.add(new SelectOption(String.valueOf(rq.get('StartDate')),String.valueOf(rq.get('FullyQualifiedLabel'))));
		}
		return optionsquarter;
  	}


 	public List<SelectOption> getUserActive(){
 		List<SelectOption> optionsua = new List<SelectOption>();
 		List<SObject> resultsua = [SELECT IsActive FROM User GROUP BY IsActive ORDER BY IsActive DESC];
 		for(SObject ua : resultsua){
 			optionsua.add(new SelectOption(String.valueOf(ua.get('IsActive')),String.valueOf(ua.get('IsActive'))));
 		}
 		return optionsua;
 	}


 	public List<SelectOption> getUserRole(){

 		List<SelectOption> optionsur = new List<SelectOption>();
 		List<SObject> resultsur = [SELECT Id, Name FROM UserRole WHERE Name LIKE '%Sales/%'];
 		for(SObject ur : resultsur){
 			
 			optionsur.add(new SelectOption(String.valueOf(ur.get('Id')),String.valueOf(ur.get('Name'))));
 		}optionsur.add(new SelectOption('','ALL'));
 		return optionsur;

 	}
	public List<User> getUsers(){
		List<User> resultsusers = new List<User>();
		resultsusers = [SELECT Id, Name FROM User WHERE IsActive = TRUE AND ForecastEnabled = TRUE LIMIT 999];
		return resultsusers; 
	}

	public void save(){
		
		upsert resultsquotas;
	}

}

And here is my visualforce :
 
<apex:page standardController="ForecastingQuota" extensions="AssignQuotaTest" sidebar="false" docType="html-5.0">


<apex:form id="formid">

<apex:pageBlock title="Kyriba Quotas" id="allthequotas">
<apex:pageBlockSection columns="2">

	<apex:outputlabel value="Date"/>
	<apex:input type="date" required="false" id="namequarter" value="{!namequarter}"/>

	<apex:outputlabel value="User Role"/>
	<apex:selectList value="{!idofuserrole}" size="1">
    	<apex:selectOptions value="{!userrole}" />
	</apex:selectList>

	<!-- <apex:outputlabel value="Active Users"/>
	<apex:selectList value="{!usertype}" size="1">
		<apex:selectOptions value="{!useractive}" />
	</apex:selectList><br/><br/> -->

<apex:commandButton value="Inactive Users" reRender="allquotas" action="{!searchQuotas}">
	<apex:param id="inactive" name="inactive" value="false" assignTo="{!changeuser}" /> 
</apex:commandButton>
<apex:commandButton value="Active Users" reRender="allquotas" action="{!searchQuotas}">
	<apex:param id="active" name="active" value="true" assignTo="{!changeuser}" /> 
</apex:commandButton>



<ul></ul>

<input type="checkbox" id="select_all"/>First Column<br/>
<input type="checkbox" id="select_all2"/>Second Column<br/>
<input type="checkbox" id="select_all3"/>Third Column<br/>
<input type="checkbox" id="select_all4"/>Fourth Column<br/>

<apex:commandButton id="saveBtn" value="Save" action="{!save}" />
<apex:commandButton value="Filter" reRender="allquotas" action="{!searchQuotas}">
</apex:commandButton>
 
</apex:pageBlockSection>

<br/><br/>
	<apex:pageBlockSection columns="4" id="allquotas">
			<apex:pageBlockTable value="{!allthequotas}" id="table" var="key">
			<apex:column>
			    <apex:inputCheckbox id="checkbox" styleClass="checkbox1"/>
			</apex:column>
			<apex:column headerValue="Name">
			    <apex:outputField  value="{!key.QuotaOwnerId}"/>
			</apex:column>
			<apex:column headerValue="Quota">
		    	<apex:inputField value="{!key.QuotaAmount}" required="false"/>
		    </apex:column>
			</apex:pageBlockTable>
			 <apex:pageBlockTable value="{!allthequotas}" var="key2">
			 <apex:facet name="header">
            	<input type="checkbox"  id="checkbox" styleClass="checkbox1"/>
            </apex:facet>
			<apex:column>
			    <apex:inputCheckbox id="checkbox" styleClass="checkbox2"/>
			</apex:column>
				<apex:column headerValue="Name">
				    <apex:outputField value="{!key2.QuotaOwnerId}"/>
				</apex:column>
    			  <apex:column headerValue="Quota">
			    	<apex:inputField value="{!key2.QuotaAmount}" id="firstquota2" required="false"/>
			    </apex:column> 
			    <apex:column headerValue="Quota">
			    	<apex:outputField value="{!key.StartDate}"/>
			    </apex:column>
			</apex:pageBlockTable> 
			 <apex:pageBlockTable value="{!allthequotas}" var="key3">
			 <apex:facet name="header">
            	<input type="checkbox"  id="checkbox" styleClass="checkbox1"/>
            </apex:facet>
			<apex:column>
			    <apex:inputCheckbox id="checkbox" styleClass="checkbox3"/>
			</apex:column>
				<apex:column headerValue="Name">
				    <apex:outputField value="{!key3.QuotaOwnerId}"/>
				</apex:column>
    			  <apex:column headerValue="Quota">
			    	<apex:inputField value="{!key3.QuotaAmount}" required="false"/>
			    </apex:column> 
			</apex:pageBlockTable> 
			 <apex:pageBlockTable value="{!allthequotas}" var="key4">
			 <apex:facet name="header">
            	<input type="checkbox"  id="checkbox" styleClass="checkbox1"/>
            </apex:facet>
			<apex:column>
			    <apex:inputCheckbox id="checkbox" styleClass="checkbox4"/>
			</apex:column>
				<apex:column headerValue="Name">
				    <apex:outputField value="{!key4.QuotaOwnerId}"/>
				</apex:column>
    			  <apex:column headerValue="Quota">
			    	<apex:inputField value="{!key4.QuotaAmount}" required="false"/>
			    </apex:column>
			</apex:pageBlockTable>
	</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>

<script type="text/javascript">
$(document).ready(function(){



var select_all = document.getElementById("select_all"); //select all checkbox
console.log(select_all);
var select_all2 = document.getElementById("select_all2");
var select_all3 = document.getElementById("select_all3");
var select_all4 = document.getElementById("select_all4");
var checkboxes = document.getElementsByClassName("checkbox1"); //checkbox items
console.log(checkboxes);
var checkboxes2 = document.getElementsByClassName("checkbox2");
var checkboxes3 = document.getElementsByClassName("checkbox3");
var checkboxes4 = document.getElementsByClassName("checkbox4");

//select all checkboxes
select_all.addEventListener("change", function(e){
    for (i = 0; i < checkboxes.length; i++) { 
        checkboxes[i].checked = select_all.checked;
    }
});
select_all2.addEventListener("change", function(e){
    for (i = 0; i < checkboxes2.length; i++) { 
        checkboxes2[i].checked = select_all2.checked;
    }
});
select_all3.addEventListener("change", function(e){
    for (i = 0; i < checkboxes3.length; i++) { 
        checkboxes3[i].checked = select_all3.checked;
    }
});
select_all4.addEventListener("change", function(e){
    for (i = 0; i < checkboxes4.length; i++) { 
        checkboxes4[i].checked = select_all4.checked;
    }
});


for (var i = 0; i < checkboxes.length; i++) {
    checkboxes[i].addEventListener('change', function(e){ //".checkbox" change 
        //uncheck "select all", if one of the listed checkbox item is unchecked
        if(this.checked == false){
            select_all.checked = false;
        }
        //check "select all" if all checkbox items are checked
        if(document.querySelectorAll('.checkbox:checked').length == checkboxes.length){
            select_all.checked = true;
        }
    });
}
for (var i = 0; i < checkboxes2.length; i++) {
    checkboxes2[i].addEventListener('change', function(e){ //".checkbox" change 
        //uncheck "select all", if one of the listed checkbox item is unchecked
        if(this.checked == false){
            select_all2.checked = false;
        }
        //check "select all" if all checkbox items are checked
        if(document.querySelectorAll('.checkbox2:checked').length == checkboxes2.length){
            select_all2.checked = true;
        }
    });
}
for (var i = 0; i < checkboxes3.length; i++) {
    checkboxes3[i].addEventListener('change', function(e){ //".checkbox" change 
        //uncheck "select all", if one of the listed checkbox item is unchecked
        if(this.checked == false){
            select_all3.checked = false;
        }
        //check "select all" if all checkbox items are checked
        if(document.querySelectorAll('.checkbox3:checked').length == checkboxes3.length){
            select_all3.checked = true;
        }
    });
}
for (var i = 0; i < checkboxes4.length; i++) {
    checkboxes4[i].addEventListener('change', function(e){ //".checkbox" change 
        //uncheck "select all", if one of the listed checkbox item is unchecked
        if(this.checked == false){
            select_all4.checked = false;
        }
        //check "select all" if all checkbox items are checked
        if(document.querySelectorAll('.checkbox4:checked').length == checkboxes4.length){
            select_all4.checked = true;
        }
    });
}
});


</script>
</apex:page>
Can you guide me for the custom save method ?

Many thanks.

 
Hi SFDC, I'm new in the Apex world :)
I have some trouble with picklist value, i will explain.
I have a picklist that show me the StartDate from the Period Objects.
I have also a List of ForecastingQuota by User.
The problem is that when I select a value in the picklist, the controller doesn't get it, so my query wich show the user can't change.
Controller :
public List<SelectOption> optionspl {get;set;}
public List<User> resultsusers{get;set;}
public Date dateinput{get;set;}
public Date dateinput2 {get;set;}


public List<SelectOption> getPeriodList(){
 		List<SelectOption> optionspl = new List<SelectOption>();
 		List<SObject> resultspl = [SELECT FullyQualifiedLabel, StartDate FROM Period WHERE StartDate > TODAY AND Type = 'Quarter'];
 		for(SObject pl : resultspl){
 			optionspl.add(new SelectOption(String.valueOf(pl.get('StartDate')),String.valueOf(pl.get('StartDate'))));
 		}
 		return optionspl;
 	}

public  List<ForecastingQuota> getAllQuotas(){
		dateinput = Date.today();
		date mydate2 = mydate.addDays(90);

		List<ForecastingQuota> resultsquotas = new List<ForecastingQuota>();
	    resultsquotas = [SELECT Id,QuotaAmount,QuotaOwnerId, StartDate FROM ForecastingQuota WHERE StartDate >:dateinput AND StartDate <:mydate2 ORDER BY QuotaOwnerId, StartDate ASC];
	    
	    List<User> resultsusers = new List<User>();
		resultsusers = [SELECT Id FROM User WHERE IsActive = TRUE AND ForecastEnabled = TRUE LIMIT 999];

		Map<Id, ForecastingQuota> fqsByOwnerId = new Map<Id, ForecastingQuota>();
			for (ForecastingQuota fq : resultsquotas)
			{
			    fqsByOwnerId.put(fq.QuotaOwnerId, fq);
			}
		
			// new map of quotas keyed by all user ids
		Map<Id, ForecastingQuota> allUserFqsByOwnerId = new Map<Id, ForecastingQuota>();
			for (User u : resultsusers)
			{
			     allUserFqsByOwnerId.put(u.id, fqsByOwnerId.containsKey(u.id) ? fqsByOwnerId.get(u.id) : new ForecastingQuota(QuotaOwnerId = u.id, QuotaAmount = null));
			    	
			}
			List<ForecastingQuota> allthequotas = new List<ForecastingQuota>();
			allthequotas = allUserFqsByOwnerId.values();
			allthequotas.sort();
			return allthequotas;
	}

And the VFP code :
<apex:pageBlockSection columns="4">
<apex:selectList value="{!dateinput2}" id="dateinput2" size="1">
    <apex:selectOptions value="{!periodlist}" />
     <apex:actionSupport event="onchange" rerender="allquotas"/>
</apex:selectList>
			<apex:pageBlockTable value="{!allquotas}" var="key">
				<apex:column>
				<input type="checkbox" name="pouet"/>
				</apex:column>
				<apex:column headerValue="Name">
				    <apex:outputField  value="{!key.QuotaOwnerId}"/>
				</apex:column>
    			<apex:column headerValue="Quota">
			    	<apex:inputField value="{!key.QuotaAmount}"/>
			    </apex:column>
			    <apex:column headerValue="Date">
			    	<apex:outputField value="{!key.StartDate}"/>
			    </apex:column>
			</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>

Thank's for the help :)
 
Hi,
I have a List of User Id :
List<User> resultsusers = new List<User>();
		resultsusers = [SELECT Id FROM User WHERE IsActive = TRUE AND ForecastEnabled = TRUE];
And a List of ForecastingQuota :
List<ForecastingQuota> resultsquotas = new List<ForecastingQuota>();
	    resultsquotas = [SELECT Id,QuotaAmount,QuotaOwnerId FROM ForecastingQuota ORDER BY StartDate ASC];
And I want to put the Id of the User with the Id of the ForecastingQuota and also his QuotaAmount in a new List.

I don't know how to make it.

Thanks for  your reponses :)


 
Hi, I make a pageBlockTable of ForecastingQuota, but when I save it, nothing happen, my QuotaAmount want to be saved.
 VFP Code :
<apex:pageMessages />
	<apex:pageBlock title="All ForecastingQuotas" id="forecast_list" mode="inlineEdit" >
	<apex:PageBlockButtons >
	    <apex:commandButton action="{!save1}" value="save"/>
	</apex:PageBlockButtons>
            <apex:pageBlockTable value="{!loadquotas}" var="qs" id="aforecastlist">
            	<apex:column headerValue="Id">
            	<apex:outputField value="{!qs.Id}"/>
            	</apex:column>
            	<apex:column headerValue="QuotaAmount">
                <apex:outputField value="{!qs.QuotaAmount }"/>
				</apex:column>
                <apex:column headerValue="QuotaOwnerId">
                <apex:outputField value="{!qs.QuotaOwnerId}"/>
				</apex:column>
                <apex:column headerValue="StartDate">
                <apex:outputField value="{!qs.StartDate}"/>
				</apex:column>
                <apex:column headerValue="ForecastingTypeId">
                <apex:outputField value="{!qs.ForecastingTypeId}"/>
				</apex:column>
                <apex:column headerValue="IsAmount">
                <apex:outputField value="{!qs.IsAmount}"/>
				</apex:column>
                <apex:column headerValue="ProductFamily">
                <apex:outputField value="{!qs.ProductFamily}"/>
				</apex:column>
                <apex:column headerValue="QuotaQuantity">
                <apex:outputField value="{!qs.QuotaQuantity}"/>
				</apex:column>
                <apex:column headerValue="PeriodId">
				<apex:outputField value="{!qs.PeriodId}"/>
				</apex:column>
		 		
				<!-- <apex:inlineEditSupport event="ondblClick"/> -->
			</apex:pageBlockTable>
	</apex:pageBlock>

Apex :
public List<ForecastingQuota> getLoadQuotas() {
		    List<ForecastingQuota> resultsquotas = new List<ForecastingQuota>();
		    resultsquotas = [SELECT Id,CurrencyIsoCode, ForecastingTypeId, IsAmount, IsQuantity, PeriodId,ProductFamily,QuotaAmount,StartDate,QuotaQuantity,QuotaOwnerId FROM ForecastingQuota ORDER BY QuotaAmount DESC];
		    return resultsquotas;
		}

public void save1() {
	    	List<ForecastingQuota> resultsquotas = new List<ForecastingQuota>();
		    resultsquotas = [SELECT Id,CurrencyIsoCode, ForecastingTypeId, IsAmount, IsQuantity, PeriodId,ProductFamily,QuotaAmount,StartDate,QuotaQuantity,QuotaOwnerId FROM ForecastingQuota];
		    
     		update resultsquotas;
     		System.debug(resultsquotas);
		}
Thanks for your help