You need to sign in to do that
Don't have an account?
Custom Object Chatter Feed
I am new to Apex, so my coding is terrible - I am looking for some help. According to the Chatter code recipes, I can add a feeditem like this:
//Adding a Text post |
02 | FeedItem post = new FeedItem(); |
03 | post.ParentId = oId; //eg. Opportunity id, custom object id.. |
04 | post.Body = 'Enter post text here'; |
05 | insert post; |
List<Aircraft_Engine__c> Engine = New List<Aircraft_Engine__c>();
Engine = [SELECT Id from Aircraft_Engine__c where Name =: sHashtag limit 1];
Aircraft_Engine__Feed EngineFeed = new Aircraft_Engine__Feed();
EngineFeed.ParentId = 'TEST'; //HERE IS THE ERROR
EngineFeed.Body = sText;
insert EngineFeed;
the code won;t compile at the line above and has the error: "Save Error: Field is not writeable: Aircraft_Engine__Feed.ParentId
Any ideas?
I solved it myself: You just use the FeedItem object and it places the chatter in the correct place using the parentid!