You need to sign in to do that
Don't have an account?
Rahul Allada
forceChatter:feed is not working as expected
I am trying to use forceChatter:feed from (https://developer.salesforce.com/docs/component-library/bundle/forceChatter:feed/documentation).
The below code is working fine and the result is as expected.
The below code is working fine and the result is as expected.
<aura:component controller="chatterController" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" > <aura:handler name="init" action="{!c.doInit}" value="{!this}" access="global" /> <aura:attribute name="contactList" type="id" /> <forceChatter:feed type="Record" subjectId="a091y000000fXREAA2" /> //Passing Record Id directly </aura:component>Whereas if I pass the SubjectId with some attribute value, results are not getting displayed as expected.
<aura:component controller="chatterController" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" > <aura:handler name="init" action="{!c.doInit}" value="{!this}" access="global" /> <aura:attribute name="contactList" type="id" /> <forceChatter:feed type="Record" subjectId="{!v.contactList}" /> //Passing Variable which has record-id(a091y000000fXREAA2) directly </aura:component>Not able to find what's the exact reason why the results are not displayed properly when I pass subjected with a variable which has the record Id.
As mentioned in the post(https://salesforce.stackexchange.com/questions/167640/forcechatterpublisher-not-loading) , Unlike force:recordEdit/reviewView the forceChatter:feed component does not support dynamically changing v.subjectId
To fix this,you need to use $A.createComponent() inside of your doInit() to construct the feed dynamically.
Sample code: Salesforce documentation related to same: https://developer.salesforce.com/docs/component-library/bundle/forceChatter:feed/documentation
Hope this helps you. Please mark this answer as best so that others facing the same issue will find this information useful. Thank you
I see you also posted this ask on https://salesforce.stackexchange.com/questions/334647/forcechatterfeed-is-not-working-as-expected and the solution is
" let me explain why the above thing is not working. As I am getting Id from the controller and in return, the Id is getting returned from the Apex controller and it's taking time as it is an asynchronous process and hence when the tag is getting rendered it is getting rendered as undefined.
Hence, to solve this issue, add this component in the controller and dynamically create it as follows:"
I see the code snippet you used is similar to above comment
Please consider marking this answer as best to close the thread and to help others facing the same issue.