I'm fairly new to SF so please bare with me.

The force:hasRecordId interface provides a component with the recordId attribute. But only in record contexts and, as it seems, only if I drop the component in the content area (v.body of my custom theme layout component) of the community builder.

These unsupported contexts include a few contexts that might seem like they should have access to the current record. Examples of these other contexts include the following:

  • Invoking the component from a global action (even when you’re on a record page)
  • Invoking the component from header or footer navigation in a community (even if the page shows a record)

I also need the current recordId in my custom navigation component, which is placed in the sidebar area. The simpliefied code of my custom theme layout component:

<aura:component implements="forceCommunity:themeLayout" access="global">
 <aura:attribute name="sidebar" type="Aura.Component[]" />
 <div class="sidebar">{!v.sidebar}</div>

The simplified code of my custom navigation component:

<aura:component extends="forceCommunity:navigationMenuBase"
 <div>RecordId: {!v.recordId}</div>

The problem is that in my navigation component, recordId is always empty. But I think I need it to mark the currently visited menu item.

Any clues how to solve this?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.