You need to sign in to do that
Don't have an account?
Overriding clone with the same page as new custom object Problem!
Hey there,
I have created a VF page with extension that will re-direct the user to a visualforce page with the correct tab open after creating a new record. I tried putting that same page onto the clone button and although it autofilled the correct fields, upon attempting to save I was left with this:
System.DmlException: Insert failed. First exception on row 0 with id a0LN0000000OsBEMA0; first error: INVALID_FIELD_FOR_INSERT_UPDATE, cannot specify Id in an insert call: [Id]
Error is in expression '{!SaveFactFinder}' in component <apex:commandButton> in page factfinderext
Class.extSaveButton.saveFactFinder: line 11, column 1
Am I able to do it like this or do I have to create an entirely different VF page and extension?
Thank you,
Mikie
There can be two possible reason for this,
1. You are trying to Insert the Existing Id and making a New Record.
You have to allow Salesforce to create a new Id for the Newly Cloned record.
Or,
2. You are trying to Insert record in a For loop.
Remove the DML statement from the For loop.
See the links below for further information,
https://developer.salesforce.com/forums/ForumsMain?id=906F00000008wswIAA
https://success.salesforce.com/answers?id=90630000000gqsLAAQ
Regards,
Ashish