Activity › Forums › Salesforce® Discussions › override standard new button using lightning component?
-
override standard new button using lightning component?
Posted by Anuj on July 8, 2020 at 12:45 PMHow to override standard new button of standard page of object using lightning component?
MOHIT replied 5 years, 10 months ago 2 Members · 1 Reply -
1 Reply
-
On the property record page in your org, click alt text: Setup Icon and select Edit Page.
Click on our new Lightning component to select it, then click alt text: Delete component to remove it from the page.
Click Save and then Back to return to your property detail page.
We’re now ready to use the component as a button override, so there’s no need for it to be on the page anymore.
In the Developer Console, switch back to the PropertyDialog component.
Add lightning:actionOverride to the list of interfaces in the aura:component tag. It should now look like this:
<aura:component implements=”flexipage:availableForRecordHome,force:hasRecordId,lightning:actionOverride” access=”global” >
Save the file.
It doesn’t matter what order the interfaces appear in. lightning:actionOverride is the magic interface that instructs Lightning Experience to let us use this component to override a standard button or action.
Set Up the Override
Back in your org, click alt text: Setup Icon and select Setup.
Click Object Manager.
Click Property.
Click Buttons, Links, and Actions.
Click alt text: Dropdown menu icon next to New and select Edit.
Select Lightning Experience Override as Lightning Component.
Select c:PropertyDialog as the bundle to override with.
The select list will list all of the components in your org that have the lightning:actionOverride interface declaration.
Click Save.
Click alt text: App Launcher icon and select Dreamhouse Lightning, then click Properties.
Refresh this page, and then click New to create a new property.
And there it is! You’ve overridden the standard New button on the Property object with a Lightning component.
Note: If you don’t see your new form, then you may need to refresh your page again. Click Properties, refresh the page, and then click New.
Log In to reply.