You need to sign in to do that
Don't have an account?
vishal yadav 86
Showing Error when iam trying to insert records
Visualforce Error
Help for this Page
System.DmlException: Insert failed. First exception on row 0 with id 0012v00002kVoWWAA0; first error: INVALID_FIELD_FOR_INSERT_UPDATE, cannot specify Id in an insert call: [Id]
Error is in expression '{!InsertSelectedRecords}' in component <apex:commandButton> in page selectedpage: Class.Acc_Dynamic.InsertSelectedRecords: line 30, column 1
Class.Acc_Dynamic.InsertSelectedRecords: line 30, column 1
Help for this Page
System.DmlException: Insert failed. First exception on row 0 with id 0012v00002kVoWWAA0; first error: INVALID_FIELD_FOR_INSERT_UPDATE, cannot specify Id in an insert call: [Id]
Error is in expression '{!InsertSelectedRecords}' in component <apex:commandButton> in page selectedpage: Class.Acc_Dynamic.InsertSelectedRecords: line 30, column 1
Class.Acc_Dynamic.InsertSelectedRecords: line 30, column 1
This error is usually comes when Inserting the list; adding more items to the list; and then trying to insert all the items you've already inserted.
It's better if you provide the code.
Thanks & Regards,
Foram Rana
Use Upsert instead of insert.
that will work for you.