+ Start a Discussion
SANKET KUMAR 28SANKET KUMAR 28 

Lightning Component To create Clone of Opportunity in edit mode with some field having default value



I want to make a lightning component which makes clone of opportunity in edit mode and it should have some default value. I dont want as standard clone functionality. it should open as popup like when we click on edit or new opportunity. Can you tell how to achieve this?
NagendraNagendra (Salesforce Developers) 
Hi Sanket,

May I request you please elaborate your problem clearly such that it is not clear to understand the problem which you are facing specifically.

If you can post the code snippet of what you have tried so far we can look into it and can help you accordingly.

Happy to help further.

Thanks,
Nagendra
MagulanDuraipandianMagulanDuraipandian
When you are in Edit mode, you cannot add button on the screen unless it is a custom component. If it is a custom component, try lighting data services which will allow you to pass default values.
Jayant DasJayant Das
Looks like you want to open a new screen from opportunity detail screen with pre-populated/default values. If that's the case, use force:createRecord. https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/ref_force_createRecord.htm
Gsam1234Gsam1234
Any updates on how to create a clone custom lightning component?
SANKET KUMAR 28SANKET KUMAR 28
Thanks all for your response.. i am able to achieve it using force:editRecord after cloning and setting the default value in apex after the clone
Gsam1234Gsam1234
Hi Sanket,

Would you be willing to share the code? 

Thanks,

Garrett