You need to sign in to do that
Don't have an account?
Netmaster
System.DmlException: Insert failed
Hello,
I saved this code to an apex class, but when I want to utilise it I get an error :
public class insererEnfant{ public List<Enfants__c> accts {get; set;} public insererEnfant(){ accts = new List<Enfants__c>(); accts.add(new Enfants__c()); } public void addrow(){ accts.add(new Enfants__c()); } public PageReference save(){ insert accts; PageReference home = new PageReference('/home/home.jsp'); home.setRedirect(true); return home; } }
The error :
System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Assuré]: [Assuré] Class.insEnfant.save: line 15, column 1
How can solve this problem, please ?
HI ,
i think when you are inserting accts you are missing a required field Assure.
if you are using accts in your visualforce page Assure filed should be there to assign value.
so you should assigen a value to the filed first and then insert.
Thanks
Shailu
Thanks,
This is my visaulforce page, I don't find the problem.
Your custom object enfants__c must have been defined with assure as a required field. And you are not setting it.
Either your controller needs to set it directly, or the page needs an inputField that is bound to it so the user can specifiy it.