You need to sign in to do that
Don't have an account?

Insert operation giving DML exception ?
This is the error . I have check field name correct , values are correct . then what would be reason ?
System.DmlException: Insert failed. First exception on row 0 with id a0E9000000pZuMyEAK; first error: INVALID_FIELD_FOR_INSERT_UPDATE, cannot specify Id in an insert call: [Id]
Error is in expression '{!genrate}' in component <apex:commandButton> in page genrate_invoice .
System.DmlException: Insert failed. First exception on row 0 with id a0E9000000pZuMyEAK; first error: INVALID_FIELD_FOR_INSERT_UPDATE, cannot specify Id in an insert call: [Id]
Error is in expression '{!genrate}' in component <apex:commandButton> in page genrate_invoice .
thanks,
http://www.forcexplore.com/2014/07/using-controller-in-visualforce-page.html
Please mark my answer as a solution to your question if it solves your problem.
whenever a record is inserted in salesforce, an Unique ID is generated for it. This ID field is read only, u cant insert/update it manually. So just remove the ID field in ur insert statement. It should work fine.
:)
Thank You