You need to sign in to do that
Don't have an account?
Sreekanth Naraboina
Updating Existing case Records from Visual Force Page
Update Existing Record from Visual Force Page
Update failed. First exception on row 0; first error: MISSING_ARGUMENT, Id not specified in an update call: []
Error is in expression '{!Save}' in component <apex:commandButton> in page massclosecasescontroller: Class.MassCloseCasesController.save: line 17, column 1
An unexpected error has occurred. Your development organization has been notified.
Apex class:
public with sharing class MassCloseCasesController {
public string CaseId{get;set;}
public List<Case> Caselist{get;set;}
public Case Caserecord{get;set;}
public MassCloseCasesController(ApexPages.StandardController controller)
{
Caserecord =(Case)Controller.getRecord();
Caseid = ApexPages.CurrentPage().getparameters().get('CaseId');
System.debug('Case id='+Caseid);
Caselist = [select id,Status,Notes__c from Case where id=:CaseId];
}
public PageReference save(){
update Caserecord;
return null;
}
}
Visualforce page:
<apex:page standardController="Case" extensions="MassCloseCasesController">
<apex:form >
<apex:sectionHeader title="Change Case Status"/>
<apex:pageBlock title="Select New Status">
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="{!Save}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection columns="1">
<apex:inputField value="{!Caserecord.Status}" style="width:15%"/>
<apex:inputField value="{!Caserecord.Notes__c}" style="width:30%"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Please anyone help me asap.
Thanks,
Sreekanth
Update failed. First exception on row 0; first error: MISSING_ARGUMENT, Id not specified in an update call: []
Error is in expression '{!Save}' in component <apex:commandButton> in page massclosecasescontroller: Class.MassCloseCasesController.save: line 17, column 1
An unexpected error has occurred. Your development organization has been notified.
Apex class:
public with sharing class MassCloseCasesController {
public string CaseId{get;set;}
public List<Case> Caselist{get;set;}
public Case Caserecord{get;set;}
public MassCloseCasesController(ApexPages.StandardController controller)
{
Caserecord =(Case)Controller.getRecord();
Caseid = ApexPages.CurrentPage().getparameters().get('CaseId');
System.debug('Case id='+Caseid);
Caselist = [select id,Status,Notes__c from Case where id=:CaseId];
}
public PageReference save(){
update Caserecord;
return null;
}
}
Visualforce page:
<apex:page standardController="Case" extensions="MassCloseCasesController">
<apex:form >
<apex:sectionHeader title="Change Case Status"/>
<apex:pageBlock title="Select New Status">
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="{!Save}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection columns="1">
<apex:inputField value="{!Caserecord.Status}" style="width:15%"/>
<apex:inputField value="{!Caserecord.Notes__c}" style="width:30%"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Please anyone help me asap.
Thanks,
Sreekanth
I understand your requirement Try the Above code to fix that error.
You Just need to change the DML Operation (Update to Upsert)
I verified in my Org. it working fine.
https://c.ap5.visual.force.com/apex/VF_Case?core.apexpages.request.devconsole=1?Id=5007F000002dEr8
When you run visualforce page try to pass Case Record ID in the URL You can refer above reference URL link.
Please let us know if it helps you. and please mark it as solved.
Regrads,
Madhukar.
Did you changed the DML operation Update call to Upsert Call.
If your done those changes, can please send me the screen shot of that, Where your are exactly facing the issue.
(or)
can please exaplin the indetail where your exactly getting the issue.
Regards,
Madhukar.