function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jeremy DeseezJeremy Deseez 

Nothing happen save method

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
karthikeyan perumalkarthikeyan perumal
Hello, 

Use below updated controller code. run  your VF page. and kinldy post the Debug log view with debug values for further analysis.
 
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('Inside Savemethod');
		System.debug('fastOppList before for = ' + fastOppList);

		List<FAST_OPP__c> fastOppListToSave = new List<FAST_OPP__c>();
		
		for(FAST_OPP__c fol : fastOppList){
		System.debug('Inside fOR LOOP');
			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('outer fOR LOOP');
			System.debug('fastOppListToSave after for' + fastOppListToSave);

		try {
			System.debug('fastOppListToSave during save' + fastOppListToSave);
			upsert fastOppListToSave;
		} catch (exception ex) {
			System.debug(ex);
		}
		return null;
	}
Thanks
karthik
 
Jeremy DeseezJeremy Deseez
Thanks for your response, but still the same, nothing happend.
 
16:18:28.0 (47127969)|SYSTEM_MODE_ENTER|true
16:18:28.0 (47201843)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:336
16:18:28.0 (47219348)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:57
16:18:28.0 (47225207)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:39
16:18:28.0 (47244180)|METHOD_ENTRY|[1]|01p6E0000000pik|ManageFAST.ManageFAST()
16:18:28.0 (47251856)|STATEMENT_EXECUTE|[1]
16:18:28.0 (47260530)|STATEMENT_EXECUTE|[1]
16:18:28.0 (47271923)|SYSTEM_MODE_ENTER|false
16:18:28.0 (47295479)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:5
16:18:28.0 (47307468)|SYSTEM_MODE_EXIT|false
16:18:28.0 (47318637)|METHOD_EXIT|[1]|ManageFAST
16:18:28.0 (60767250)|SYSTEM_MODE_ENTER|true
16:18:28.0 (60935520)|SYSTEM_MODE_ENTER|true
16:18:28.0 (61277465)|SYSTEM_MODE_ENTER|true
16:18:28.0 (61378434)|SYSTEM_MODE_ENTER|true
16:18:28.0 (68251129)|SYSTEM_MODE_ENTER|true
16:18:28.0 (69261764)|SYSTEM_MODE_ENTER|true
16:18:28.0 (69309271)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:19
16:18:28.0 (69342504)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:60
16:18:28.0 (69392867)|VARIABLE_ASSIGNMENT|[EXTERNAL]|this.selectedQuarter|"2016-01-01 00:00:00"|0x265de9a3
16:18:28.0 (69671870)|SYSTEM_MODE_ENTER|true
16:18:28.0 (69695408)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:13
16:18:28.0 (69701907)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:60
16:18:28.0 (69712882)|VARIABLE_ASSIGNMENT|[EXTERNAL]|this.typeOfOpp|"Forecast Exit"|0x265de9a3
16:18:28.0 (73558144)|SYSTEM_MODE_ENTER|true
16:18:28.0 (73618575)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:4
16:18:28.0 (73637019)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:60
16:18:28.0 (73658603)|VARIABLE_ASSIGNMENT|[EXTERNAL]|this.typeOfOpp|"none"|0x265de9a3
16:18:28.0 (74101536)|SYSTEM_MODE_ENTER|true
16:18:28.0 (74126214)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:4
16:18:28.0 (74132397)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:60
16:18:28.0 (74143316)|VARIABLE_ASSIGNMENT|[EXTERNAL]|this.typeOfOpp|"none"|0x265de9a3
16:18:28.0 (74505656)|SYSTEM_MODE_ENTER|true
16:18:28.0 (74528573)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:4
16:18:28.0 (74534413)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:60
16:18:28.0 (74544848)|VARIABLE_ASSIGNMENT|[EXTERNAL]|this.typeOfOpp|"none"|0x265de9a3
16:18:28.0 (74929934)|SYSTEM_MODE_ENTER|true
16:18:28.0 (74953280)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:4
16:18:28.0 (74960002)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:60
16:18:28.0 (74972311)|VARIABLE_ASSIGNMENT|[EXTERNAL]|this.typeOfOpp|"none"|0x265de9a3
16:18:28.0 (75403131)|SYSTEM_MODE_ENTER|true
16:18:28.0 (75450812)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:28
16:18:28.0 (75457651)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:60
16:18:28.0 (75583633)|VARIABLE_ASSIGNMENT|[EXTERNAL]|this.sumOfAmount|151097.93|0x265de9a3
16:18:28.0 (78692187)|SYSTEM_MODE_ENTER|true
16:18:28.0 (106624086)|SYSTEM_MODE_ENTER|true
16:18:28.0 (107073261)|SYSTEM_MODE_ENTER|true
16:18:28.0 (108232768)|SYSTEM_MODE_ENTER|true
16:18:28.0 (112301464)|SYSTEM_MODE_ENTER|true
16:18:28.0 (112471620)|SYSTEM_MODE_ENTER|true
16:18:28.0 (128891963)|SYSTEM_MODE_ENTER|true
16:18:28.0 (130971123)|VF_SERIALIZE_VIEWSTATE_BEGIN|0666E0000008ylh
16:18:28.0 (137298648)|VF_SERIALIZE_VIEWSTATE_END
16:18:28.142 (142121163)|CUMULATIVE_LIMIT_USAGE
16:18:28.142 (142121163)|LIMIT_USAGE_FOR_NS|(default)|