2

I am working on a lightning component where i am using forceChatter:publisher and forceChatter:feed.

I have put this in a component named ChatterCmp. This component is inside RecordViewComponent.

Now, when the RecordViewComponent is triggered via event, this passes object id as attribute to ChatterCmp, and i am using it in the ContextId and RecordId of chatter aura component.

But this is not working. I have printed the Id, which comes correctly, but because of some reason Chatter components are not accepting those ids.

<aura:attribute name="objid" type="string" access="global"/>
<aura:handler event="c:icChatterComponentTrigger" action="{!c.icChatterComponentTrigger}"/>
<forceChatter:publisher context="RECORD" recordId="{!v.objid}" />
<forceChatter:feed type="record" subjectId="{!v.objid}"/> 

enter image description here

Am i missing anything here?

4

I found the solutions:

Unlike force:recordEdit/reviewView the forceChatter:feed component does not support dynamically changing v.subjectId - I just went and looked and there is no logic in the component to trigger reloading the feed when subjectId changes. The component does have a refreshFeed() method but its not marked access="GLOBAL" so no joy there either. Same for the refresh event handler.

All is not lost though - I would switch to using $A.createComponent() inside of your doInit() to construct the feed dynamically - not hard to do - and then your existing container component will work just fine.

$A.createComponent(
"forceChatter:publisher", {
    "context": "RECORD",
    "recordId": ideaselected
},
function(recordFeed) {
    //Add the new button to the body array
    if (component.isValid()) {
        var body = component.get("v.body");
        body.push(recordFeed);
        component.set("v.body", body);
    }
}); 

$A.createComponent(
"forceChatter:feed", {
    "type": "Record",
    "subjectId": ideaselected
},
function(recordFeed) {
    //Add the new button to the body array
    if (component.isValid()) {
        var body = component.get("v.body");
        body.push(recordFeed);
        component.set("v.body", body);
    }
});

Courtesy: Lightning component not getting on load value

2
  • Bagaria did the approach mentioned above work? Were you able to get the publisher to show anything? Apr 20 '17 at 8:53
  • It worked like charm!! Go for it. Apr 21 '17 at 12:03

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.