function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Joel HowardJoel Howard 

Custom button on highlights panel

New to Salesforce development.  I've spent about one day so far reviewing SF training materials.

I would like to add a button to the Opportunities highlights panel in Lightning.  When clicked, this button would call custom code (Apex class?) and then respond back with a message (Error or success).  Any tips or pointers?  I'm thinking I need to create a custom Lightning component and have it interact with the Apex class (calls external API and processes data).  Is this possible?  Any tips or examples come to mind?
Best Answer chosen by Joel Howard
VinayVinay (Salesforce Developers) 
Hi Joel,

You would use Quick Actions instead of buttons in Lightning.

Review below link which has details.

https://trailblazers.salesforce.com/answers?id=90630000000Zf7vAAC

Thanks,
Vinay Kumar

All Answers

VinayVinay (Salesforce Developers) 
Hi Joel,

You would use Quick Actions instead of buttons in Lightning.

Review below link which has details.

https://trailblazers.salesforce.com/answers?id=90630000000Zf7vAAC

Thanks,
Vinay Kumar
This was selected as the best answer
Joel HowardJoel Howard
If I need to do very complex things with my button such as all of the following:
  • Identify current user
  • Submit POST to external API
  • Display response from external API
  • Launch new browser window
Would you still recommend Quick Actions?  Or a new Visualforce page with a button -- and include this page on the Opportunity layout?
VinayVinay (Salesforce Developers) 
Hi Joel,

You can invoke Visualforce pages using quick actions so that you can handle complex DML operations using a controller.

https://help.salesforce.com/articleView?id=actions_overview.htm&type=5

Thanks,
Vinay Kumar
Joel HowardJoel Howard
Vinay your responses helped me head in the right direction.  Ultimately what we ended up doing was creating an auora action that acts as a wrapper for a LWC (since LWC arent supported as actions yet).  The LWC handles all of the rendering of the UI and backend Apex code.  Thanks!
VinayVinay (Salesforce Developers) 
Good to know it helped you and thanks.

Cheers..!!