Lightning Component Clone with Related Records

In this blog, I am going to explain a simple quick action lightning component that will clone the records and its related data also. In this example, I am controlling which all objects are allowed to as part of the cloning is through the custom metadata data types.

These are the records for metadata 

Apex Class

Lightning Component 

 

controller.js

helper.js

 

Creating Quick Action 

You will be able to create quick action with the above components shown below.Go to the object manager and create a quick action as shown below.

After saving the action, add this action to the page layout. this component we can reuse it on any object.

Once the user clicks on the clone button its will clone the parent and all child records data along with relationship as shown below.