Tuesday, June 26, 2018

Lightning Component record ID when component in Lightning Page:

Interfaces:

force:hasRecordId,
force:appHostable,
force:lightningQuickAction,
force:lightningQuickActionWithoutHeader
forceCommunity:availableForAllPageTypes,
flexipage:availableForAllPageTypes,
flexipage:availableForRecordHome,
clients:availableForMailAppAppPage,
clients:hasEventContext,
clients:hasItemContext,
ltng:allowGuestAccess

You need to implement the interface:
force:hasRecordId
in your component and then you can access the record id via the following expression
{!v.recordId}
An example component would be:
<aura:component controller="CTRL_F_Controller" implements="flexipage:availableForAllPageTypes,force:hasRecordId">
<aura:attribute name="Account" type="Account"/>
    <ltng:require styles="/resource/bootstrap"/>
    <div class="bootstrap-sf1">
       <div class="container">
           <ui:outputText class="form-control" aura:id="recid" value="{!v.recordId}" />
        </div>
    </div>
</aura:component>

Some of these interfaces are summarized below. For a complete list, refer to the Component Library.
<aura:component controller="CreateCandidateRecord" 
    implements="force:hasRecordId,
force:appHostable,
force:lightningQuickAction,
force:lightningQuickActionWithoutHeader
forceCommunity:availableForAllPageTypes,
flexipage:availableForAllPageTypes,
flexipage:availableForRecordHome,
clients:availableForMailAppAppPage,
clients:hasEventContext,
clients:hasItemContext,
ltng:allowGuestAccess"> 
clients:availableForMailAppAppPage
To appear in the Lightning App Builder or a Lightning Page in Lightning for Outlook or Lightning for Gmail, a component must implement the clients:availableForMailAppAppPage interface. For more information, see Create Components for Lightning for Outlook and Lightning for Gmail.
clients:hasEventContext
Enables a component to be assigned to an event’s date or location attributes in Lightning for Outlook and Lightning for Gmail. For more information, see Create Components for Lightning for Outlook and Lightning for Gmail.
clients:hasItemContext
Enables a component to be assigned to an email’s or a calendar event’s item attributes in Lightning for Outlook and Lightning for Gmail. For more information, see Create Components for Lightning for Outlook and Lightning for Gmail.
flexipage:availableForAllPageTypes
A global interface that makes a component available in the Lightning App Builder, and for any type of Lightning page. For more information, see Configure Components for Lightning Pages and the Lightning App Builder.
To appear in the utility bar, a component must implement the flexipage:availableForAllPageTypes interface. For more information, see Add a Utility Bar to Lightning Appsin Salesforce Help.
flexipage:availableForRecordHome
If your component is designed only for record pages, implement the flexipage:availableForRecordHome interface instead of flexipage:availableForAllPageTypes. For more information, see Configure Components for Lightning Experience Record Pages.
forceCommunity:availableForAllPageTypes
To appear in Community Builder, a component must implement the forceCommunity:availableForAllPageTypes interface. For more information, see Configure Components for Communities.
force:appHostable
Allows a component to be used as a custom tab in Lightning Experience or the Salesforce app. For more information, see Add Lightning Components as Custom Tabs in a Lightning Experience App.
force:lightningQuickAction
Allows a component to display in a panel with standard action controls, such as a Cancel button. These components can also display and implement their own controls, but should handle events from the standard controls. If you implement force:lightningQuickAction, you can’t implement force:lightningQuickActionWithoutHeader within the same component. For more information, see Configure Components for Custom Actions.
force:lightningQuickActionWithoutHeader
Allows a component to display in a panel without additional controls. The component should provide a complete user interface for the action. If you implement force:lightningQuickActionWithoutHeader, you can’t implement force:lightningQuickAction within the same component. For more information, see Configure Components for Custom Actions.
ltng:allowGuestAccess
Add the ltng:allowGuestAccess interface to your Lightning Out dependency app to make it available to users without requiring them to authenticate with Salesforce. This interface lets you build your app with Lightning components, and deploy it anywhere and to anyone. For more information, see Share Lightning Out Apps with Non-Authenticated Users.