Quantcast
Channel: Active questions tagged feeditem - Salesforce Stack Exchange
Viewing all articles
Browse latest Browse all 160

Update FeedItem Body

$
0
0

I have very simple version of a class that needs to update body of FeedItem as part of a test class. updateFeed() is throwing this error message: "System.SObjectException: Field is not writeable: FeedItem.Body" I understand it says the field cannot be updated, but this was working previously and suddenly stopped working.

I am the record owner. v43. What am I missing?

public without sharing class testFeed{

static FeedItem feedToCreate = new FeedItem();
public static void createFeed(){        
    feedToCreate.ParentId = '001xxxxxxxxxx';
    feedToCreate.Body = 'test body';
    feedToCreate.Type = 'TextPost';
    insert feedToCreate;
}

public static void updateFeed(){    
    list<feeditem> feedToUpdate = new list<Feeditem>();
    for(FeedItem fItem : [select Id, body, ParentId from FeedItem where id=:feedToCreate.id limit 1]){
        **fItem.Body = 'test';**
        feedToUpdate .add(fItem);  
    }
    update feedToUpdate;
}

}


Viewing all articles
Browse latest Browse all 160

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>