So I created for te first time a lightning component and I'm just getting familiar with it all. What I did was create the apex controller, the lightning component, the js contoller and the js helper.

What I want is once the method is executed and the email sent, we display it in the component via the 'v.sendstatus'.

But the "component.set("v.sendstatus","Sent successfully")" seems to never be working which I don't understand why. At first I thought maybe there's something wrong with the callback function but even when alone right after it, nothing still. (Btw I would appreciate it if you let me know wether the if and else are correct?)

The code is actually working once I use the component I get the popup which is blank (the problem I'm facing) however the email gets sent with no problem.

So my thought are that this line "component.set("v.sendstatus","Sent successfully")" is the problem but that's the syntax I find people use. But maybe I'm not using correctly? I would really appreciate your help thank you

For the Apex controller:

public class EmailManager {
    public static void getsendEmail(String receiverid, String subject, String body) {
    // Code here


<aura:component controller="EmailManager" implements='force:lightningQuickActionWithoutHeader,force:hasRecordId'>

   <aura:handler name="init" value="{!this}" action="{!c.doInit}" /> 
   <aura:attribute name="recordId" type="Id" />


JS Controller: ({ doInit : function(component, event, helper) { helper.sendemail(component); } })

JS Helper:

sendemail : function(component, event, helper) {

    var action = component.get("c.getsendEmail");
        "receiverid": component.get("v.recordId"),
        "subject" : "subject",
        "body": "body"
//  component.set("v.sendstatus","Sent successfully"); not working

    action.setCallback(this, function(actionResult) {
        var state = actionResult.getState();
        if(state == 'SUCCESS') {
            component.set('v.sendstatus',"Sent successfully");
        } else if(state == 'ERROR') {
            component.set('v.sendstatus',"An error has occured");
        } else {
            console.log("something went wrong!");

  • Have you checked your Javascript Developer Console? Maybe you have some problem inside the javascript callback function and that code can not be compiled and because of that, the code is not executed
    – Patlatus
    Commented Apr 18, 2019 at 11:35
  • @Patlatus Actually I checked commenting that callback and using only the set.component alone but still it didn't work
    – dotname
    Commented Apr 18, 2019 at 11:37

2 Answers 2


You need to define sendstatus as an attribute:

<aura:attribute name="sendstatus" type="String" />

Also, it is recommended that you do not define a recordId attribute when using force:hasRecordId, as this may cause problems. You should consider removing this attribute from your component markup.

  • I made the modification but still nothing, does the parameter name should only have sendstatus? I also erased the the recordId as instructed but still nothing?
    – dotname
    Commented Apr 18, 2019 at 11:53
  • @dotname Anything in the browser's developer console? You have lots of debug messages, I presume something should show up there.
    – sfdcfox
    Commented Apr 18, 2019 at 11:57
  • I actually didn't find anything in the console it looks like the callback isn't working. When I added a console.log() before it did show up though. But I'm not sure why the component wasn't set either sinc I uncommented this line "// component.set("v.sendstatus","Sent successfully"); " Is the syntax correct?
    – dotname
    Commented Apr 18, 2019 at 14:39
  • @dotname Yes, that's the correct syntax. Not sure what else to tell you.
    – sfdcfox
    Commented Apr 18, 2019 at 14:43
  • my bad I just realized that I had forgotten to uncomment the line where v.sendstatus was after a previous attempt. It's working now, thank you
    – dotname
    Commented Apr 18, 2019 at 16:13

You have to create <aura:attribute> in your Lightning component.

<aura:attribute type="String" name="sendstatus"/>
  • I did the modification but there was no change still nothing is displayed
    – dotname
    Commented Apr 18, 2019 at 11:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .