Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added create functions to allow batch processing #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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