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
Sameeer TSameeer T 

lightning button without action pop up

Hi All,

I have created component for lightning button 'Email Team Member'. This button has ability to open outlook email whenever I click on this button. So the problem I am facing currently is when I click on this button it's opening one pop up from where I have to click again on the button.

 

See this attached pictures here!

Button 

When I click on Email Team Member button above, below screen pop - up from where i have to click again on button.

User-added image

Any help would be appreciated.

 

Thanks

GarryPGarryP
this is the defualt behavirour of ligthning quick actions.
you will have to write the logic , which is currently nehind button "Email Team Meber" click, in the init method of your lightnign component.
After that when you click on the quick action button it wll initailize the compoennt and will do required action.
Ashif KhanAshif Khan
Hi Sameer,
You can call your button action from aura:handler init.
<aura:handler name="init" value="{!this}" action="{!c.yourAction}"/>
or you can add your component to record page using lightning app builder
https://trailhead.salesforce.com/en/modules/lightning_app_builder/units/lightning_app_builder_recordpage

I hope it will help you

Regards
Ashif 
Sameer T 2Sameer T 2

Thank you for your reply :)

 

So currently what i have in lightning component is

 

<aura:component implements="lightning:actionOverride,force:lightningQuickActionWithoutHeader,force:hasRecordId,flexipage:availableForAllPageTypes" access="global" controller="PDM_RequestUpdatesProduct">
    <aura:handler name="init" action="{!c.init}" value="{!this}"/>
    
    <lightning:button variant="brand" label="Email Team Member" onclick="{! c.emailTeamMember }">
    
    </lightning:button>
    
</aura:component>

 

 

Here is my lightning controller

 

({
    emailTeamMember : function(component,event,helper){
        var action = component.get("c.requestProductProgramRecordUpdate");
        action.setParams({
      "prodProgId": component.get("v.recordId")
    });
        
          action.setCallback(this, function(a) {
            
              var teamMembers=a.getReturnValue();
              console.log("team members are"+teamMembers);
              if(teamMembers!=''){
                  
                  window.location.href = "mailto:"+teamMembers;
                  window.close();
              }
              else
                  alert('No Team Members');

        });
        $A.enqueueAction(action);
        
    }
})

 

 

So I dont want that action pop and instead wants that button to open outlook mail on first click.

 

Ashif KhanAshif Khan
Hi Sameer,

You need to use emailTeamMember action in <aura:handler it will directly launch your mail popup
 
<aura:component implements="lightning:actionOverride,force:lightningQuickActionWithoutHeader,force:hasRecordId,flexipage:availableForAllPageTypes" access="global" controller="PDM_RequestUpdatesProduct">
    <aura:handler name="init" action="{!c.emailTeamMember}" value="{!this}"/>
    
 </aura:component>
 
({
    emailTeamMember : function(component,event,helper){
        var action = component.get("c.requestProductProgramRecordUpdate");
        action.setParams({
      "prodProgId": component.get("v.recordId")
    });
        
          action.setCallback(this, function(a) {
            
              var teamMembers=a.getReturnValue();
              console.log("team members are"+teamMembers);
              if(teamMembers!=''){
                  
                  window.location.href = "mailto:"+teamMembers;
        
/***to close popup ***/
var dismissActionPanel = $A.get("e.force:closeQuickAction");
   dismissActionPanel.fire();
                  window.close();
              }
              else
                  alert('No Team Members');

        });
        $A.enqueueAction(action);
        
    }
})