You need to sign in to do that
Don't have an account?
apex code for Custom Object Chatter Feed
trying to modify a test trigger for the Chat Up app as advised in the documentation, and I'm not sure how I should change some of the code to reference a custom object instead of Account.
The sample code is:
test.startTest(); insert myOpportunities; test.stopTest(); /*there should be 100 posts as you iterated 100 times*/ List<AccountFeed> chatterPosts = [select id from AccountFeed where parentId = :a.id]; System.assertEquals(chatterPosts.size(), 100);
So I modified "AccountFeed" to my custom object "npe03__Recurring_Donation__c"
test.startTest();
insert myOpportunities;
test.stopTest();
/*there should be 100 posts as you iterated 100 times*/
List<npe03__Recurring_Donation__cFeed> chatterPosts = [select id from npe03__Recurring_Donation__cFeed where parentId = :a.id];
System.assertEquals(chatterPosts.size(), 100);
and I get this error:
Error: Compile Error: sObject type 'Recurring_Donation__cFeed' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names. at line 26 column 56
I've enabled Feed Tracking on the Recurring_Donation__c object (although I haven't selected any other fields to track. Clearly it's not as simple as replacing "Account" with "npe03__Recurring_Donation__c"
How to fix?
Thanks, Amanda
When a custom object has a feed it will not include the __c suffix, rather it will become __Feed. Try replacing these:
Recurring_Donation__cFeed
With:
Recurring_Donation__Feed
All Answers
When a custom object has a feed it will not include the __c suffix, rather it will become __Feed. Try replacing these:
Recurring_Donation__cFeed
With:
Recurring_Donation__Feed
~ Amanda
I need your help in creating Chatter Feed Tracking through Apex Trigger.
I have a Custom Object with 8 Related List Objects. Whenever a related object record is created or deleted a chatter post need to shown.
I tried this in Standard way using Feed Tracking but it only creates chatter post when a record is created. Its not working when the record is deleted. I need to show the chatter feed even for the deletion Example( Test123- Jaweed deleted a capture team).
Thanks,
Jaweed