Skip to content

Conversation

@Henk3000
Copy link

I was using this code to create a chatter post on a trigger and had a requirement to create a chatter post for each record and therefore I concluded that I needed to bulk insert the feed items.

As the current repo only allowed me to post individual feed items I altered it to "create" instead of directly posting a feed item.

my code now looks like this:

List<ConnectApi.BatchInput> batchInputs = new List<ConnectApi.BatchInput>();
for(Account acc : accs){
  String postMessage = 'test post message for {record:' + acc.Id + '}';
  ConnectApi.FeedItemInput input = ConnectApiHelper.createFeedItemWithRichText(acc.Id, postMessage);
  batchInputs.add(new ConnectApi.BatchInput(input));
}
ConnectApi.ChatterFeeds.postFeedElementBatch(null, batchInputs);

@salesforce-cla
Copy link

Thanks for the contribution! Unfortunately we can't verify the commit author(s): Erik <e***@r***.nl>. One possible solution is to add that email to your GitHub account. Alternatively you can change your commits to another email and force push the change. After getting your commits associated with your GitHub account, sign the Salesforce.com Contributor License Agreement and this Pull Request will be revalidated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant