Skip to main content
2 of 3
added 541 characters in body
Annappa PH
  • 2.3k
  • 7
  • 39
  • 88

You need to use this interface: force:hasRecordId

 <aura:component implements="force:lightningQuickAction,force:hasRecordId,force:appHostable,flexipage:availableForRecordHome,force:hasRecordId,force:hasSObjectName" access="global" >
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<b>This is recordID {!v.recordId} </b><br/>
</aura:componet>

javascript:

 doInit:function(componet,event,helper){
   component.get("v.recordId");
  }

Notes:

  • If your component implements force:hasRecordId, you don’t need to add a recordId attribute to the component yourself

  • The component’s controller can access the ID of the current record from the recordId attribute, using component.get("v.recordId"). The recordId attribute is automatically added to the component by the force:hasRecordId interface.

Read this Link for more Information:

https://developer.salesforce.com/docs/component-library/bundle/force:hasRecordId/documentation

Annappa PH
  • 2.3k
  • 7
  • 39
  • 88