function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
PabitraPabitra 

How to create a clone button in lightning for cloning specific fields?

I want to achieve in lightnign experience(may be through lightning component or lightning flow or lightning web component ), place a button on record detail page.This button functionality almost same with standard clone button feature.But here we are cloning the record with certain fields.Edit window also came before save the record where we can able to change record values whereever we want(may be any look up field,picklist field or text field).Can any one guide please?Thanks in advance.
Khan AnasKhan Anas (Salesforce Developers) 
Hi Pabitra,

Greetings to you!

As per Salesforce Knowledge Article: https://help.salesforce.com/articleView?id=000322260&type=1&mode=1 (https://help.salesforce.com/articleView?id=000322260&type=1&mode=1)

For Lightning, currently, there's no out of the box functionality available. There is no direct out of box functionality to do this using custom button and quick actions. You can use the example process outlined below to achieve the same in Lightning via customization.

1. Create a Lightning component that will open any record that one wishes to clone. Make use of force:hasRecordId interface. This enables the component to be assigned the ID of the current record. 
2. In the controller part, the force:hasRecordId interface will provide the id to clone the record and one can create business logic to make necessary changes in values accordingly.
3. The changed values can be displayed in a view/screen or modal pop up, along with save & cancel button.
4. Use that Lightning component to be called on the click of a "Quick Action".

Please refer to the below links which might help you further with the above requirement.

https://developer.salesforce.com/forums/?id=9060G000000UVLQQA4

https://success.salesforce.com/answers?id=9063A000000pLTtQAM

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas
PabitraPabitra
Hi Khan Anas,

I appriciate your interest! But before also I gone through this above info.Later I tried with lightning component and failing to achieve what I want.I'm new to the lightning.So can you assist me programmetically please?

Many Thanks!
PabitraPabitra
Khan Anas,

Also can you suggest me  if the object having more than one layout and with more look up field, how to achieve it?

Thanks!