Usage of lightning:actionOverride

Here we will understand how to override the different salesforce standard action on lightning using lightning component. In order to override any action, your component must implement lightning:actionOverride interface. This interface is a marker interface. A marker interface is a signal to the component’s container to add the interface’s behavior to the component. You don’t need to implement any specific methods or attributes in your component, you simply add the interface name to the component’s implements attribute. The lightning:actionOverride doesn’t add or require any attributes on components that implement it. Components that implement this interface don’t automatically override any action. You need to manually override relevant actions in Setup. However in Lightning Experience, the standard Tab and View actions display as a page, while the standard New and Edit actions display in an overlaid panel. When used as action overrides, Lightning components that implement the lightning:actionOverride interface replace the standard behavior completely. However, overridden actions always display as a page, not as a panel. Your component displays without controls, except for the main Lightning Experience navigation bar. Your component is expected to provide a complete user interface for the action, including navigation or actions beyond the navigation bar.

Overriding the new action 

Here is the sample code to override the new action. the component has implemented the lightning:actionOverride interface and we are using the force:recordData for input form.

Now go ahead and override the new action with the above code as shown below

Once you click on the new button it will prompt the new screen as shown below.

Overriding the Edit Action 

Use the below code to override the edit action. In this example we are using force:recordEdit to show the edit form.

Go and override the Edit action with the above code as shown below.
Once you click on the edit button you can able to see the screen as shown below.

 

Overring The View Action 

Use the below code to override the view action. Here I am using the force: recordView form to view the data.

Now override the view action as shown below.

Once you are trying to view the record you can able to see the screen as shown below

Overriding the Tab 

Use the below code to override the tab. In this example, i am using the lightning:listView  to get the list of opportunities.

Now override the tab action with the above code as shown below

You can see the opportunity tab now as shown below.