I'm trying to retrieve recordId and sObjectName from a component put on the utility bar. The point is it always retrieves me 'undefined' in both cases.

<aura:component implements="force:hasRecordId,force:hasSObjectName,flexipage:availableForAllPageTypes"/>


doInit : function(component, event, helper) {

Is there something wrong with my code? Or it's just that I can't retrieve it from an utility bar component? And if that's so, how can I fix this?

1 Answer 1


force:hasRecordId only works in certain contexts. The documentation states:

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)

While it does not specifically call it out, I would not be surprised to note that a utility bar cannot detect this value.

  • In fact, the documentation does mention this: 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. In all other cases, such as when you invoke the component as a global action, or create the component programmatically inside another component, recordId isn’t set, and your component shouldn’t depend on it.*
    – Jayant Das
    Commented Nov 13, 2018 at 14:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .