You need to sign in to do that
Don't have an account?
Jeremy 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 :
Thanks
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
Use below updated controller code. run your VF page. and kinldy post the Debug log view with debug values for further analysis.
Thanks
karthik