Quantcast
Viewing latest article 30
Browse Latest Browse All 54

Connect Api feedItem is not posting for the experience cloud users

I am trying to create a feedItemPost via code below and I want this feed to be visible across all experience sites within the org as well as on backend SF on the Case record. But it is not working out. This code sits in an apex after trigger on a custom object which is child object to case via lookup.In the same trigger I am also testing new feedItem() and it works!

public static void createFeedItems(List<feedItemWrapper> feedItemList){    if(! feedItemList.isEmpty()){        List<ConnectApi.BatchInput> batchInputs = new List<ConnectApi.BatchInput>();        for(feedItemWrapper fI : feedItemList){              ConnectApi.FeedItemInput feedItemInput = new ConnectApi.FeedItemInput();             feedItemInput.feedElementType = ConnectApi.FeedElementType.FeedItem;            feedItemInput.subjectId = fI.subjectId;            feedItemInput.body = fI.messageBody;            feedItemInput.Visibility = ConnectApi.FeedItemVisibilityType.AllUsers;            ConnectApi.BatchInput batchInput = new ConnectApi.BatchInput(feedItemInput);            batchInputs.add(batchInput);        }        if(! batchInputs.isEmpty()){            ConnectApi.ChatterFeeds.postFeedElementBatch(Network.getNetworkId(), batchInputs);        }    }}

Viewing latest article 30
Browse Latest Browse All 54

Trending Articles