I am trying to display a lightning component as a button on the lightning record page in the highlights panel beside standard salesforce buttons. Is there any way to add custom component within highlights panel?
I don't think there is a perfect solution for now but you have several options:
- You can make use of the Lightning Component Quick Action anyway and do something like this:
- Your markup would just display a waiting message, like "Updating", why not with a spinning wheel. The idea is that with this solution you have to display a modal, so just display a waiting message for the user instead of a white modal
- Do your update using your component, using JS Controller / Apex
- Fire both
force:showToastevents once your work is done. This will display your message in the Toast, and close the modal without any manual interaction from the user
- Use a Visualforce page in a Detail Page Button, this will redirect you for maybe 1 second to a white page, Apex Controller will do the work and redirect back to your record with a PageReference. You won't be able to show the toast though.
- Use a custom button that you'll put on your page through AppBuilder. You'll be able to do what you want but the button will be somewhere else on the page, so it might be confusing for users.