Questions tagged [connect-api]

ConnectApi is the Apex namespace that includes Chatter in Apex functionality.

Filter by
Sorted by
Tagged with
15
votes
4answers
7k views

How can I add an @mention when creating a FeedItem via APEX?

I have found that this can be done via the Chatter API, and that there is a pilot program (http://developer.force.com/cookbook/recipe/connect-in-apex-pilot) to bring this to APEX, but I am not ...
11
votes
2answers
13k views

How can I create a Chatter File via Apex?

From the Chatter tab I can go to 'Files' and then upload a file without attaching it to anything. I am wanting to know if there is a way to achieve the exact same thing via Apex?
10
votes
1answer
794 views

Is There a Way to Get Chatter Notifications?

If you @mention or send a message to a Chatter user, you get a notification in Salesforce1. This appears immediately so it's a safe bet that push notifications are being used to dispatch them. However ...
9
votes
2answers
609 views

Does 'Chatter in Apex' aka Chatter Connect API support Bulkified insert operations?

I want to add Chatter feeds from Trigger and obviously I am going to implement this as Bulkified. I have data in the following format. Public Class ChatterFeedInfo { public Id usermentionId {get;...
8
votes
2answers
1k views

How to add permission to Salesforce Chatter Collaboration Group sObject?

I have communities enabled in my org and i have a class which will auto add the new registered member to a chatter group. CollaborationGroupMember cand = new CollaborationGroupMember(...
7
votes
1answer
306 views

What Controls the URL Format for Chatter Content?

When I query the chatter connect API through Javascript from a Visualforce page in a desktop browser, the post attachment URLs I receive use the visualforce domain that the page is being served up ...
5
votes
2answers
3k views

How do I make a Visualforce PDF respect new line characters?

I have a Visualforce page where I need to show the chatter posts in a PDF. The chatter post is generated by apex code and contains new line characters. I am querying the posts and displaying them ...
5
votes
1answer
2k views

Retrieve UserId of @mention user from chatter post in Apex

Is there a way to retrieve the user id of @mention user from chatter post in Apex? We can write a before insert trigger on feeditem, but when we display the body (which has @mention user) it simply ...
4
votes
1answer
341 views

Chatter in Apex: is it DML?

So there's times you can't DML (getters, constructors, components without allow DML, etc). Can we use chatter in apex, or is that also considered inserting records?
4
votes
1answer
93 views

Find the source device of a FeedItem / FeedComment

When looking at the Chatter Feed some posts or comments have the addition by what mobile device this post/comment was issued from. I would like to query that device information via apex, but can't ...
4
votes
2answers
2k views

How do I write tests for custom classes that primarily use ConnectApi?

I have implemented a VF page that displays a Chatter Group feed using the example classes provided in the Salesforce Cookbook. I have implemented all of these classes (with some tweaks and added ...
3
votes
1answer
1k views

How can I specify a record (or parentId) for a postFeedItem to be posted to?

I am trying to create a chatter post using an APEX trigger, and I'm almost there. I've gotten to this point: ConnectApi.ChatterFeeds.postFeedItem(null, ConnectApi.FeedType.News, 'me', feedItemInput, ...
3
votes
1answer
824 views

Post to a Chatter feed as a different user than the logged un user from a Trigger

I have a trigger that posts to a Project Object's feed and @mentions someone. The only problem is that I need to be able to post the message as another user, not the user who is logged in. How can I ...
3
votes
2answers
2k views

Record chatter post with link

Using ConnectApi Reference: http://www.salesforce.com/us/developer/docs/apexcode/Content/connectAPI_outputs.htm#capi_entityLinkSeg_output I want to create from apex code a chatter post on a record, ...
3
votes
1answer
2k views

Can I get Community ID without ConnectAPI?

The current documented way to retrieve the ID of a given community is via the ConnectAPI class. While this works, the ConnectAPI class has a special requirement: any use of ConnectAPI methods ...
3
votes
1answer
433 views

Can Chatter Connect API set createdByUser to other than logged in user?

I know this question has been asked earlier but I could not find the answer. I am trying to create chatter Feed using Chatter connect API and my need is "Createdby user should be different than ...
3
votes
1answer
3k views

Error: The Connect API is not enabled for this user type

I am working on creating a Force.com site and I have a VF page which displays fields from a custom object record and also displays its Chatter feed. I achieved displaying the Chatter feed using the ...
3
votes
2answers
104 views

How to Show only the posts and comments from people I follow?

I want to replicate people filter logic in apex which shows only the posts and comments from people I follow. Is there any connectApi Namespaces availabe for this? Please suggest. Thanks.
3
votes
2answers
2k views

why need seeAllData = true in test class when use connectAPI

In my controller i'm using connectApi and my class functionality is working fine but the issue is when i'm using in my Test class (SeeAllData=true) it's covered 100% but seeAllData = true is not ...
3
votes
1answer
1k views

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

I have created a webservice APEX class that I need to write a Unit test for. The webservice assembles a custom filtered list of Chatter 'FeedElements'. All 'FeedElements' are system created, i.e. they ...
3
votes
1answer
217 views

Get the name of User who posted in a group in Connect API

I am creating a custom chatter page in Visualforce (kinda reinventing the wheel) by using Connect API. I am able to get the list of feeds for the user using the following connect API call: ...
3
votes
1answer
929 views

How to use ConnectApi.ChatterFeeds class if Chatter is disabled

I have the following problem: my code uses ConnectApi.ChatterFeeds.postFeedElement and ConnectApi.ChatterFeeds.postFeedElementBatch methods to operate feed items. That works properly is Chatter is ...
3
votes
1answer
459 views

Feed Items and Badges

I'm trying to write a trigger that awards badges to people and then posts them in a chatter post. I've found this: https://help.salesforce.com/HTViewSolution?id=000199013&language=en_US Which is ...
3
votes
0answers
266 views

How can we update profile picture of user on onCreateUser()?

I use ConnectApi to modify picture of User in custom salesforce login (Facebook, Twitter...), as follows: global void updateUser(Id userId, Id portalId, Auth.UserData data){ ... ConnectApi....
3
votes
0answers
359 views

References to URLs returned by Apex ConnectApi in Salesforce1 mobile

I have a VF page that I am using as an inline page on the Opportunity detail page layout. It retrieves and displays files (FeedItems with ConnectApi.ContentCapability) from Chatter feeds on records ...
2
votes
2answers
5k views

How to dynamically creating chatter groups in Apex?

It looks like ConnectApi.ChatterGroup is abstract. Is there really no way to create Chatter groups via connect in Apex? Is the solution to call the chatter REST API from APEX? UPDATED based on ...
2
votes
2answers
912 views

How to get Chatter photo fileId?

I'm trying to use ConnectApi.ChatterUsers.getUserBatch() to migrate users' photos. However, the ConnectApi.User object that I get only seems to have access, through its photo property, to the ...
2
votes
1answer
2k views

Unable to create ConnectApi test data

I'm stuck trying to write a test method for the ConnectApi. Specifically, I have a remote action that uses the ConnectApi.QuestionAndAnswers.getSuggestions() method, which returns related (Chatter) ...
2
votes
2answers
4k views

Creating a FeedItem Using Connect in APEX

My goal is to create a trigger/class that, when a Financial Account (custom object) has it's balance change by more than 20% in either direction, creates a chatter post informing users of the 'Big ...
2
votes
4answers
988 views

creating Chatter FeedItem with sites user

is it possible to create a chatter FeedItem with a sites user with public access, is there any workaround to get this done? I tried to insert it with "insert" and also with the ConnectApi but I got ...
2
votes
1answer
1k views

Unable to send myself a test Chatter Message

I am trying to send myself a test Chatter message as the first step towards a proof of concept. The desired outcome is that I will get a private chat message pop up in the bottom right-hand corner of ...
2
votes
2answers
117 views

New ConnectAPI.PollCapabilityInput() Compile Fail

​ConnectApi.PollCapabilityInput pollInput = new ConnectApi.​PollCapabilityInput(); The above code does not compile. The error says: Error: Compile Error: Invalid type: ConnectApi.​...
2
votes
1answer
324 views

Assigning a Topic when using postFeedElementBatch

I'm using the sample code from this part of the Developer's Guide to create Chatter Posts when certain conditions are met on a Case record. It all works well, but I'm not seeing any way that I can ...
2
votes
2answers
1k views

How can i get Thumbnail Image depending on files of chatter?

First of all i have a question how will i pull my files that i find in chatter Tab for community user through Chatter Connect In APEX or REST API? And Also I need to display Icon based on image .Lets ...
2
votes
1answer
28 views

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

In Summer '19, we got access to a new POST method on the connect/communities endpoint, allowing for programmatic creation of a Community: Make a POST request to the existing /connect/communities ...
2
votes
1answer
295 views

Error when adding user to Chatter group with ConnectApi: Unknown user (System Code)

I have a trigger (onAfter insert User) that adds a newly created User (with Community profile assigned) to a public Chatter Group. For this I have used ConnectApi. The code is the following: public ...
2
votes
1answer
85 views

How to connect to ConnectApi in visual studio

I am in Visual Studio 2015 and I can connect to Salesforce using the Salesforce.Commmon, Salesforce.Force, and Salesforce.Chatter namespaces, but I can not use the ConnectApi namespace shown here, on ...
2
votes
1answer
633 views

Post chatter feed element from other chatter account [duplicate]

How can i use a different chatter account to post feed items. This is because I am posting feed elements from apex. But the user doesnt get notified when tagged himself(@mention) in feed. So i ...
2
votes
1answer
267 views

ConnectApiHelperTest testMethod generating error for API version 35

Have been using the ConnectApiHelper from here https://github.com/forcedotcom/ConnectApiHelper Appears this test class starting failing when calling the testCreateInputFromBody() testmethod. It ...
2
votes
1answer
878 views

NoAccessException on ConnectApi.ChatterFeeds.updateFeedElement : line 706 column 1

Urgent Help Needed: I am getting exception while updating a chatter feed using ConnectApi.ChatterFeeds class. I am not getting it regularly but for some specific users under a particular custom ...
2
votes
2answers
471 views

Error message: Only user and group IDs may be used in inline mentions

I've written a program where I used the ConnectApi class and especially the postFeedElement function. First I've implemented all in a Dev. Org (Spring '15) where I tested it, the tests ran all well. ...
2
votes
0answers
20 views

Multiple Files on chatter Feed is not showing when created from apex

I see Chatter post can allow multiple files to be posted at a time in Lightning. But from the below code in Apex, I'm only able to get one file on the chatter post. List<ConnectApi.BatchInput> ...
2
votes
2answers
199 views

Platform events and Chatter Posts

I am subscribing to platform events in apex trigger. In the trigger I am trying to post to user's chatter feed using Chatter Connect API. I am aware that in this case the context is "Automated Process"...
2
votes
0answers
137 views

dashboard component snapshot via code

Is there a way to take snapshot of a dashboard component and get the url of the image, all via code? I tried to use ConnectApi.DashboardComponentSnapshot, but i get error saying i can't construct a ...
2
votes
0answers
170 views

Push Notification for Chatter Group not Working

I am using chatter group and implemented the Push Notification using ConnectApi.ChatterFeeds.postFeedElementBatch(Network.getNetworkId(), chatterPosts), but the push notification is not working. Now ...
2
votes
0answers
166 views

ConnectAPI updateFeedElement with new mention in trigger double email

I'm coding a trigger for "FeedItem" to automatically add a mention to a certain user. I'm following pretty much the same logic stated here (by adding a new mention segment to the feed input): https:/...
2
votes
0answers
350 views

Only user and group IDs may be used in inline mentions

I'm creating Chatter feed items using connect API apex. I want a simple message that contains a link to the user and a related object, e.g. opportunity. I'm getting this message when running the code ...
2
votes
0answers
2k views

Chatter in APEX (Connect API) with VF: Best practices to avoid limits

I am currently working on using "Chatter in APEX" aka ConnectApi to display feeds from custom object records in a Visualforce page. I am using one VF page with links that re-render the same page but ...
1
vote
2answers
539 views

Invalid type: ConnectApi.User​​GroupPage

I'm working on a Visualforce page where I want to grab a user's groups and paginate over the list. Getting the groups is pretty straightforward using the ConnectApi's ChatterUsers.getGroups method (...
1
vote
1answer
51 views

How can I mark 'Best Answer' through ConnectApi?

How do I mark an answer as Best Answer through ConenctApi? I tried setting bestAnswerId of ConnectApi.QuestionAndAnswersCapabilityInput but it does not mark the answer as Best Answer. ConnectApi....