Posts

Showing posts with the label salesforce 2025 release

Headless action button using LWC (No Modals)

Image
  A headless quick action executes custom code in a Lightning web component. Unlike a screen action, a headless action doesn’t open a modal window. Expose invoke() as a public method for headless quick actions; the invoke() method executes every time the quick action is triggered. Return type of invoke() is void . Using async will make invoke()  execute asynchronously.  // js file import { LightningElement, api } from 'lwc'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class DispatchEventHeadlessAction extends LightningElement {     @api recordId;      isExecuting = false;     @api async invoke() {           if (this.isExecuting) {           // This code uses a boolean flag to block a double execution            return;          }           this.isExecuting ...