You need to sign in to do that
Don't have an account?
Ab
Deep clone of opportunity with related list custom and standard in apex
Hello,
I am trying to do deepclone by below method.
i want to clone opportunity with related list
but when i do system debug for oppClone, it only contains ID
and i have below error
Error:
insert failed. First exception on row 0 with id 0060Q00000D3AnjQAF; first error: INVALID_FIELD_FOR_INSERT_UPDATE, cannot specify Id in an insert call: [Id]
I am trying to do deepclone by below method.
i want to clone opportunity with related list
currentOpp = (Opportunity)stdController.getRecord(); Opportunity oppClone = currentOpp.clone(false, true);
but when i do system debug for oppClone, it only contains ID
and i have below error
Error:
insert failed. First exception on row 0 with id 0060Q00000D3AnjQAF; first error: INVALID_FIELD_FOR_INSERT_UPDATE, cannot specify Id in an insert call: [Id]
You need to fetch all the fields which you want to clone, something like mentioned below :
Do let me know if it helps you and close your query by marking it as solved.