When to use force hasrecordid interface in aura?

When to use force hasrecordid interface in aura?

This interface is used to indicate that a component takes a record (SObject) as an attribute. Add the force:hasRecordId interface to an Aura component to enable the component to be assigned the ID of the current record.

Where do I find record ID in force?

You need to pass record id which can be captured by implementing component using force:hasRecordId interface. This is straight forward, if the component is placed on record page, record id will be available in recordId attribute. Using lightning data service, the field information will be available to use in component.

How to add recordid to lightning aura component?

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. For more information, see the Lightning Aura Components Developer Guide.

When to use recordid attribute in Salesforce Lightning?

Important The recordId attribute is set only when you place or invoke the component in an explicit record context. For example, when you place the component directly on a record page layout, or invoke it as an object-specific action from a record page or object home.

Why do I not pass record ID to lightning component?

In the “Building Context-Aware Lightning Components” article, my Javascript Helper and Javascript Controller both have code similar to the Client-side controller source code from that article. I have my code set up this way because I was following the Salesforce tutorial. I still seem to not be passing the RecordId.

How to get the recordid in the component which is invoked through quick?

I have a component which is invoked through quick action present in event record page .The component is referring to force:hasRecordId interface . The value of recordid is resulting to undefined when debugged. This is weird. It should have worked.