Skip to main content
New
Stack Overflow Jobs powered by Indeed: A job site that puts thousands of tech jobs at your fingertips (U.S. only). Search jobs
14 votes
Accepted

why need seeAllData = true in test class when use connectAPI

The alternative to using seeAllData=true is applying a mocking or delegate pattern so that the Connect API is not called in test context, but you can still validate behavior. Here's a simple and very ...
David Reed's user avatar
  • 93.1k
8 votes
Accepted

Retrieve standard and custom notifications of a user in Apex

Unfortunately, no. The endpoint you're using seems exactly what you want/need - but, as you noted, will only give you custom notifications. You can see this older question that mentions the lack of ...
Kris Goncalves's user avatar
6 votes

Chatter Post and Tag user from Apex Trigger

You can work with the ConnectApi ChatterFeeds classes to post directly yourself. Using postFeedElement(communityId, feedElement) should be enough to swap in with your original top code (where you ...
Kris Goncalves's user avatar
5 votes
Accepted

Create a Custom Chatter Stream from Apex ConnectApi

Here is example apex code of creating a simple stream subscribing to two entities (an account and opportunity). Since ConnectApi (aka Chatter in Apex) always runs as the context user then this stream ...
Doug Ayers's user avatar
  • 4,196
4 votes
Accepted

ConnectApi.NotFoundException: Resource not found (ConnectApi.Communities)

From docs mentioned here : You will only get Ids of the Communities the running user has access to. You have to Give that profile access to that community. In other words, you have to make that ...
Pranay Jaiswal's user avatar
4 votes
Accepted

ConnectApi.ConnectApiException: Context user does not have permission to create rich text in feed

For whatever reason, the org had Chatter Settings | Rich Text Posts | Allow users to compose rich text posts unchecked. You can deploy this setting using the MetadataAPI in the Chatter.settings file ...
cropredy's user avatar
  • 71.8k
3 votes
Accepted

What is the actual number or calculation for the Connect API Rate Limit

I opened a case with Salesforce support to get more information and the response is that it may differ based on what APIs are being called and to talk to your Salesforce AE about pricing and limits ...
Peter Knolle's user avatar
  • 29.1k
3 votes
Accepted

How can I mark 'Best Answer' through ConnectApi?

You need to use ConnectApi.QuestionAndAnswers.updateQuestionAndAnswers after this. https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/...
Sushil Bhardwaj's user avatar
3 votes
Accepted

Unit Testing ConnectApi.ChatterFeeds.getFeedElementBatch with auto-created feed posts

Unfortunately it's not possible to create these types of feed items in unit tests, for the reasons described in the documentation for Isolation of Test Data from Organization Data in Unit Tests: ...
alouie's user avatar
  • 2,893
3 votes

How can I create a Chatter File via Apex?

Create Content Version String yourFiles = 'All your info goes here'; ContentVersion conVer = new ContentVersion(); conVer.ContentLocation = 'S'; // S specify this document is in SF, use E for ...
Nishant Singh Panwar's user avatar
2 votes

Retrieve UserId of @mention user from chatter post in Apex

Here is the update of the code for 2023, getFeedItem is no longer support in latest API version. String communityId = null; String feedItemId = 'YOUR_FEEDITEM_ID'; ConnectApi.FeedElement feedItem = ...
Petr Novotny's user avatar
2 votes
Accepted

Post chatter feed element from other chatter account

Currently, both Chatter in Apex and the Chatter REST API do not support impersonation like the SObject API does. You can only post feed items as the current, logged-in user. This is documented in "...
Benjamin Pirih's user avatar
2 votes
Accepted

Files Connect: How to create SharePoint folder?

As of May 25, 2017, the ConnectApi in Apex does not support creating folders. Confirmed by Salesforce product managers Arnab Bose and Haris Ikram. In the meanwhile, please vote for this idea: ...
Doug Ayers's user avatar
  • 4,196
2 votes
Accepted

How do I test that a ConnectApi.AnnouncementInput has been posted to a CollaborationGroup?

Chatter Announcements are nothing but FeedItem records. You can just query them after creating an announcement in test class SELECT Body,CreatedById,CreatedDate,HasVerifiedComment,NetworkScope,...
Pranay Jaiswal's user avatar
2 votes
Accepted

Can the new Chatter API Communities resource create a Visualforce Tabs community?

I don't think this is documented, but I figured it out by looking at the outbound requests from the Communities wizard in Chrome Inspector. The template name that the Connect API accepts for ...
David Reed's user avatar
  • 93.1k
2 votes

Tag and @mentions in custom LWC?

You need to use postFeedItemWithMentions instead of postFeedElement. There are numerous examples online on how to achieve this: @mention in chatterfeed apex (view the unaccepted answer posted, ...
glls's user avatar
  • 20.2k
2 votes
Accepted

Setup ConnectApi.FeedElementPage with message mentions for Test (setTestGetFeedElementsFromFeed)

I found that you can retrieve your actor using ConnectApi.ChatterUsers.getUser(communityId, userId) so with that I can set the record reference like so: mention.record = (ConnectApi.ActorWithId) ...
Sadistik's user avatar
1 vote
Accepted

Salesforce CMS REST API: /search `NOT_FOUND`

When I tried the URL you posted I too got 404 error code. Then I manually typed in the endpoint /services/data/v50.0/connect/cms/delivery/channels/0ap7F000000KyutQAC/contents/search?page=1&...
Swetha Maddali's user avatar
1 vote
Accepted

ConnectApi.CommerceCatalog.getProduct on inactive product

We've had this issue before in our project, here is what we did. ConnectApi Commerce class methods respects the structure of your storefront (I.E Entitlements, Pricebooks, Products) So as a workaround:...
malacdon's user avatar
  • 311
1 vote
Accepted

Creating a chatter post with inline images from Flow

There's a pretty viable workaround. You could update the LWC that unofficialsf uses to remove Image from formats used by lightning-input-rich-text. This prevents users from putting images in the rich ...
Kris Goncalves's user avatar
1 vote
Accepted

createReturnOrder

You're currently trying to call a method that exists within the ReturnOrder class under the ConnectApi namespace through your variable idReturnOrder. The method isn't defined in that variable which is ...
Kris Goncalves's user avatar
1 vote

Does the url value for MarkupBeginSegmentInput matter?

Through some trial and error, I have discovered that the url property is used when the inner segment is not a URL. Meaning when you select a piece of text to link somewhere.
aaron's user avatar
  • 855
1 vote

Reaching Connect API's hourly request limit for this user and application?

Log a case with support. They have tools to troubleshoot. Alternatively, if you own the Event Monitoring product, you can do the analysis yourself, looking at the oDataCallout event type. https://...
eyewell's user avatar
  • 161
1 vote

Chatter API vs ConnectAPI

The Connect API is meant to be used in situations where you want to do posts in Apex: Visualforce, Apex code triggers, and Lightning. You would not ordinarily write a custom REST API service when ...
sfdcfox's user avatar
  • 494k
1 vote

How to display Data in tabular format when Posting it to Chatter via Apex?

Currently ConnectApi.MarkupType supports following markups : Bold—Bold tag. Code—Code tag. Italic—Italic tag. ListItem—List item tag. OrderedList—Ordered list tag. Paragraph—Paragraph tag. ...
Pragati Jain's user avatar
  • 1,570
1 vote

Connect to SharePoint from Apex using Files Connect API

I believe I got this working by adding additional trusts to SharePoint. I originally had added FullControl to both the web and site collection, I added Read for both and it seems like it's working. ...
Derrick Bowen's user avatar
1 vote
Accepted

ConnectApi.NotFoundException: Resource not found

If you are calling it from Rest Api then Network.getNetworkId() will not work and you have to hard code the network Id. So place network Id instead of Network.getNetworkId() and it will work ...
Tarachand Karwal's user avatar
1 vote
Accepted

Chatter Post Link Lightning Experience Problems

Sadly, the feature I want doesn't look to be possible at the moment. Here are a few articles on it: Look under "Chatter Publisher" here: chatter winter 16 release notes Here's the idea in salesforce ...
Jimmy Hong's user avatar
1 vote
Accepted

How to connect to ConnectApi in visual studio

The ConnectAPI documentation you linked to is for Apex. Note that it states: The ConnectApi namespace (also called Chatter in Apex) provides classes for accessing the same data available in Chatter ...
Daniel Ballinger's user avatar
1 vote
Accepted

ConnectApiHelperTest testMethod generating error for API version 35

Just figured this out. If you navigate to setup Chatter - chatter settings. An option called Rich Text Posts was disabled. Enabling this option allows users to post rich text chatters and will get ...
Benjamin Pirih's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible