Skip to main content
I have a very simple Lightining component included in Chatter of a case record, and I am trying to get the recordId of the case, but its coming as 'undefined'. As per the docs, I have implemented force:hasRecordId marker interface. 

Component:

<aura:component implements="force:lightningQuickAction,force:hasRecordId">

    <!-- recordId is always empty here -->

    Record Id is =====> {!v.recordId}

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

</aura:component>

Controller:

({

    doInit: function(component, event, helper) {

        console.log(component.get("v.recordId"));  //debug console shows 'undefined' here

    } 

})

Is there anything I am missing here? Thanks in advance.

 
1 answer
  1. Sep 10, 2017, 11:26 AM
    Make sure you are invoking component in a record context in Lightning Experience or Salesforce1.
0/9000