force:hasRecordId cascade?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty{ margin-bottom:0;
}






up vote
2
down vote

favorite












I am looking for verification/documentation on force:hasRecordId. It appears from my experience that recordId is only provided to the "container" component, and it does not feed down to any child components without explicitly passing the value.



Is that right?



BTW, I've read the docs here. They don't address my question.










share|improve this question






















  • Can you clarify with a snippet what you think it needs vs what you hope it does?
    – Sebastian Kessel
    6 hours ago

















up vote
2
down vote

favorite












I am looking for verification/documentation on force:hasRecordId. It appears from my experience that recordId is only provided to the "container" component, and it does not feed down to any child components without explicitly passing the value.



Is that right?



BTW, I've read the docs here. They don't address my question.










share|improve this question






















  • Can you clarify with a snippet what you think it needs vs what you hope it does?
    – Sebastian Kessel
    6 hours ago













up vote
2
down vote

favorite









up vote
2
down vote

favorite











I am looking for verification/documentation on force:hasRecordId. It appears from my experience that recordId is only provided to the "container" component, and it does not feed down to any child components without explicitly passing the value.



Is that right?



BTW, I've read the docs here. They don't address my question.










share|improve this question













I am looking for verification/documentation on force:hasRecordId. It appears from my experience that recordId is only provided to the "container" component, and it does not feed down to any child components without explicitly passing the value.



Is that right?



BTW, I've read the docs here. They don't address my question.







lightning-components






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 6 hours ago









PatMcClellan__c

657217




657217












  • Can you clarify with a snippet what you think it needs vs what you hope it does?
    – Sebastian Kessel
    6 hours ago


















  • Can you clarify with a snippet what you think it needs vs what you hope it does?
    – Sebastian Kessel
    6 hours ago
















Can you clarify with a snippet what you think it needs vs what you hope it does?
– Sebastian Kessel
6 hours ago




Can you clarify with a snippet what you think it needs vs what you hope it does?
– Sebastian Kessel
6 hours ago










1 Answer
1






active

oldest

votes

















up vote
5
down vote













I think the documentation covers it, but it's not very explicit and relies on us to read into a couple of key words that aren't obviously key words.




A marker interface is a signal to the component’s container to add the interface’s behavior to the component




Emphasis mine. Later,




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.




Emphasis again mine.



So if we have Components A and B, here:



componentA.cmp



<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" >
<c:componentB />
</aura:component>


componentB.cmp



<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" >
{! v.recordId }
</aura:component>


You get no output if you place this on a record page. (I did validate this directly).



But if componentA, which is componentB's container, supplies the record Id:



<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" >
<c:componentB recordId="{! v.recordId }" />
</aura:component>


You will indeed observe the output.



Only componentA is in an "explicit record context", which the documentation implicitly defines for us as a record page container or use as an object-specific action.



componentB is not in an explicit record context (it could be anywhere) and requires its container, componentA, to provide the recordId.






share|improve this answer























  • Another wonderful answer, David. I wish I had grokked what the OP needed with as little input as you did
    – Sebastian Kessel
    1 hour ago











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "459"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f241412%2fforcehasrecordid-cascade%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
5
down vote













I think the documentation covers it, but it's not very explicit and relies on us to read into a couple of key words that aren't obviously key words.




A marker interface is a signal to the component’s container to add the interface’s behavior to the component




Emphasis mine. Later,




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.




Emphasis again mine.



So if we have Components A and B, here:



componentA.cmp



<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" >
<c:componentB />
</aura:component>


componentB.cmp



<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" >
{! v.recordId }
</aura:component>


You get no output if you place this on a record page. (I did validate this directly).



But if componentA, which is componentB's container, supplies the record Id:



<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" >
<c:componentB recordId="{! v.recordId }" />
</aura:component>


You will indeed observe the output.



Only componentA is in an "explicit record context", which the documentation implicitly defines for us as a record page container or use as an object-specific action.



componentB is not in an explicit record context (it could be anywhere) and requires its container, componentA, to provide the recordId.






share|improve this answer























  • Another wonderful answer, David. I wish I had grokked what the OP needed with as little input as you did
    – Sebastian Kessel
    1 hour ago















up vote
5
down vote













I think the documentation covers it, but it's not very explicit and relies on us to read into a couple of key words that aren't obviously key words.




A marker interface is a signal to the component’s container to add the interface’s behavior to the component




Emphasis mine. Later,




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.




Emphasis again mine.



So if we have Components A and B, here:



componentA.cmp



<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" >
<c:componentB />
</aura:component>


componentB.cmp



<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" >
{! v.recordId }
</aura:component>


You get no output if you place this on a record page. (I did validate this directly).



But if componentA, which is componentB's container, supplies the record Id:



<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" >
<c:componentB recordId="{! v.recordId }" />
</aura:component>


You will indeed observe the output.



Only componentA is in an "explicit record context", which the documentation implicitly defines for us as a record page container or use as an object-specific action.



componentB is not in an explicit record context (it could be anywhere) and requires its container, componentA, to provide the recordId.






share|improve this answer























  • Another wonderful answer, David. I wish I had grokked what the OP needed with as little input as you did
    – Sebastian Kessel
    1 hour ago













up vote
5
down vote










up vote
5
down vote









I think the documentation covers it, but it's not very explicit and relies on us to read into a couple of key words that aren't obviously key words.




A marker interface is a signal to the component’s container to add the interface’s behavior to the component




Emphasis mine. Later,




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.




Emphasis again mine.



So if we have Components A and B, here:



componentA.cmp



<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" >
<c:componentB />
</aura:component>


componentB.cmp



<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" >
{! v.recordId }
</aura:component>


You get no output if you place this on a record page. (I did validate this directly).



But if componentA, which is componentB's container, supplies the record Id:



<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" >
<c:componentB recordId="{! v.recordId }" />
</aura:component>


You will indeed observe the output.



Only componentA is in an "explicit record context", which the documentation implicitly defines for us as a record page container or use as an object-specific action.



componentB is not in an explicit record context (it could be anywhere) and requires its container, componentA, to provide the recordId.






share|improve this answer














I think the documentation covers it, but it's not very explicit and relies on us to read into a couple of key words that aren't obviously key words.




A marker interface is a signal to the component’s container to add the interface’s behavior to the component




Emphasis mine. Later,




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.




Emphasis again mine.



So if we have Components A and B, here:



componentA.cmp



<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" >
<c:componentB />
</aura:component>


componentB.cmp



<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" >
{! v.recordId }
</aura:component>


You get no output if you place this on a record page. (I did validate this directly).



But if componentA, which is componentB's container, supplies the record Id:



<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" >
<c:componentB recordId="{! v.recordId }" />
</aura:component>


You will indeed observe the output.



Only componentA is in an "explicit record context", which the documentation implicitly defines for us as a record page container or use as an object-specific action.



componentB is not in an explicit record context (it could be anywhere) and requires its container, componentA, to provide the recordId.







share|improve this answer














share|improve this answer



share|improve this answer








edited 5 hours ago

























answered 6 hours ago









David Reed

27.1k51745




27.1k51745












  • Another wonderful answer, David. I wish I had grokked what the OP needed with as little input as you did
    – Sebastian Kessel
    1 hour ago


















  • Another wonderful answer, David. I wish I had grokked what the OP needed with as little input as you did
    – Sebastian Kessel
    1 hour ago
















Another wonderful answer, David. I wish I had grokked what the OP needed with as little input as you did
– Sebastian Kessel
1 hour ago




Another wonderful answer, David. I wish I had grokked what the OP needed with as little input as you did
– Sebastian Kessel
1 hour ago


















draft saved

draft discarded




















































Thanks for contributing an answer to Salesforce Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f241412%2fforcehasrecordid-cascade%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Mouse cursor on multiple screens with different PPI

Agildo Ribeiro

Sometime when accessing a menu: “Ubuntu 16.04 has experienced an internal error”