+ Start a Discussion
vishal yadav 86vishal 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
Foram Rana RForam Rana R
Hi Vishal,

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
satish palsatish pal
Hi Vishal,
Use Upsert instead of insert.
that will work for you.