You need to sign in to do that
Don't have an account?
Masie Maseli
System.DmlException: Update failed. First exception on row 0; first error: MISSING_ARGUMENT, Id not specified in an update call
May someone please help, I have a visualforce wizard that updates a lead, creates two custom object records and is supposed to keep updating the same record from one page to another. I can create the two records but when it is supposed to update the record it cannot find the record id that was created in the previous page, public PageReference purposeSaveBtn(). So my code is not working from public PageReference strategySaveBtn() can someone please assist.
public class benchmarkingExtension{ Private Final Lead thelead; public Benchmarking_Result__c br {get;set;} public Benchmarking_Focus_Area__c fc {get;set;} public List <string> checkboxSelections {get;set;} Public ApexPages.StandardController stdcontroller; // The extension constructor initializes the private member variable acct by using the getRecord method from the standard controller. public benchmarkingExtension(ApexPages.StandardController stdcontroller) { this.thelead = (Lead)stdController.getRecord(); getBenchmarking_Focus_Area(); getBr(); } public Benchmarking_Focus_Area__c getBenchmarking_Focus_Area(){ if( fc == null) { fc = new Benchmarking_Focus_Area__c(); } else{ fc = [select id, name from Benchmarking_Focus_Area__c where Lead__c = :thelead.id]; } return fc; } public Benchmarking_Result__c getBr() { if (br == null ){ br = new Benchmarking_Result__c(); } else{ br = [select id, CSI_part_of_company_culture__c, Responsibility_Measurement__c , Allocation_of_Impact__c , Government_Interaction__c , Engagement_with_Government__c, Reasons_for_not_Partnering__c , Branding__c , Amount_of_Partnerships__c , Signed_MOUs__c , Company_Vision_Social_Impact__c , Who_partner_with__c , Alignment_to_Vision_and_Mission__c , Financial_contribution__c , Clear_Vision_Mission__c, Living_of_CSI_Vision__c, CSI_team_knows_reason_for_existance__c, Reason_for_CSI__c from Benchmarking_Result__c where Lead__c = :thelead.id]; } return br; } public Lead getLead(){ return thelead; } //Method for populating checkboxes -- q1 public List<SelectOption> getItems(){ Schema.sObjectType sobject_type = Benchmarking_Result__c.getSObjectType(); Schema.DescribeSObjectResult sobject_describe = sobject_type.getDescribe(); Map<String, Schema.SObjectField> field_map = sobject_describe.fields.getMap(); List<Schema.PicklistEntry> pick_list_values = field_map.get('Clear_CSI_Strategy_Result__c').getDescribe().getPickListValues(); List<selectOption> items = new List<selectOption>(); for (Schema.PicklistEntry a : pick_list_values){ items.add(new SelectOption(a.getLabel(), a.getValue())); } return items; } public List<SelectOption> getItems1(){ Schema.sObjectType sobject_type = Benchmarking_Result__c.getSObjectType(); Schema.DescribeSObjectResult sobject_describe = sobject_type.getDescribe(); Map<String, Schema.SObjectField> field_map = sobject_describe.fields.getMap(); List<Schema.PicklistEntry> pick_list_values = field_map.get('Who_partner_with__c').getDescribe().getPickListValues(); List<selectOption> items1 = new List<selectOption>(); for (Schema.PicklistEntry a : pick_list_values){ items1.add(new SelectOption(a.getLabel(), a.getValue())); } return items1; } // M&E question 7 // public List<SelectOption> getItems3(){ // Schema.sObjectType sobject_type = Benchmarking_Result__c.getSObjectType(); // Schema.DescribeSObjectResult sobject_describe = sobject_type.getDescribe(); // Map<String, Schema.SObjectField> field_map3 = sobject_describe.fields.getMap(); // List<Schema.PicklistEntry> pick_list_values = field_map3.get('Challenges_with_M_E__c').getDescribe().getPickListValues(); // // List<selectOption> items3 = new List<selectOption>(); // for (Schema.PicklistEntry a : pick_list_values){ // items3.add(new SelectOption(a.getLabel(), a.getValue())); // } // return items3; // } /// //Methods for 'Save' buttons on VF pages public PageReference cancel() { return null; } public PageReference filteringCriteriaSaveBtn() { update thelead; fc.Lead__c = thelead.Id; fc.name = 'Focus Area' ; upsert fc; PageReference callNextPage = new PageReference('/apex/Purpose?id='+thelead.id); callNextPage.setRedirect(true); return callNextPage; } public PageReference purposeSaveBtn() { br.Lead__c = theLead.id; br.name = 'Benchmark Result' ; upsert br; PageReference callNextPage = new PageReference('/apex/Strategy_Developement?id='+thelead.id); callNextPage.setRedirect(true); return callNextPage; } public PageReference strategicDevSaveBtn() { update br; PageReference callNextPage = new PageReference('/apex/Implementation?id='+thelead.id); callNextPage.setRedirect(true); return callNextPage; } public PageReference strategySaveBtn() { update br; PageReference callNextPage= new PageReference('/apex/Collaboration?id='+thelead.id); callNextPage.setRedirect(true); return callNextPage; } public PageReference implementationDevSaveBtn() { // update br; stdcontroller.save(); PageReference callNextPage= new PageReference('/apex/CSI_Positioning_And_Governence?id='+thelead.id); callNextPage.setRedirect(true); return callNextPage; } public PageReference CollaborationDevSaveBtn() { update br; PageReference callNextPage= new PageReference('/apex/M_And_E?id='+thelead.id); callNextPage.setRedirect(true); return callNextPage; } public PageReference MAndEDevSaveBtn(){ // update br; stdcontroller.save(); PageReference callNextPage= new PageReference('/apex/CSI_Positioning_And_Governence?id='+thelead.id); callNextPage.setRedirect(true); return callNextPage; } public PageReference CSI_PositioningDevSaveBtn() { // update br; stdcontroller.save(); PageReference callNextPage= Page.Team; callNextPage.setRedirect(true); return callNextPage; } public PageReference TeamSaveBtn() { // update br; stdcontroller.save(); PageReference callNextPage=new PageReference('/apex/Innovation?id='+thelead.id); callNextPage.setRedirect(true); return callNextPage; } public PageReference InnovationSaveBtn() { update br; PageReference callNextPage= new PageReference('/apex/OutputPage?id='+thelead.id); callNextPage.setRedirect(true); return callNextPage; } }
Thanks
Pradeep
Mark this answer solved if this resolve your problem.
Thanks
Pradeep
Mark this answer solved if this resolve your problem.