Lightning Components Actions Override

Introduction:-

In this blog, I am going to show how to override the standard action for the lightning experience by using lightning component. To override the standard action with the lightning component you need to implement lightning:actionOverride interface. You can override the View, New, Edit, and Tab standard actions on most standard and all custom components. Overriding standard actions allows you to customize your org using Lightning components, including completely customizing the way you view, create, and edit records.There are six standard actions available on most standard and all custom objects: Tab, List, View, Edit, New, and Delete.Components you plan to use as action overrides usually need details about the object type they’re working with, and often the ID of the current record. Your component can implement the following interfaces to access those object and record details.Add the force: hasRecordId interface to a Lightning component to enable the component to be assigned the ID of the current record. The current record ID is useful if the component is used on a Lightning record page, as an object-specific custom action or action override in Lightning Experience or the Salesforce app, and so on.Add the force: hasSObjectName interface to a Lightning component to enable the component to be assigned the API name of current record’s sObject type. The sObject name is useful if the component can be used with records of different sObject types, and needs to adapt to the specific type of the current record.

New Action Override

Create a new lightning component with the below code

Go to object manager and override the new  button action as shown below 

View Action Override

Crate a new lightning component with below code

Override the view action as shown below

Override Edit Action

Create a new Lightning component with below code

Override the edit action as shown below

 In this example, i used the lightning:recordEditForm and lightning:recordViewForm components to wrap the form for edit and view modes.