You need to sign in to do that
Don't have an account?
MattMet86
@mention - ConnectAPIHelper not working
The APEX Dev guide says that you can use a helper method to simplify doing @mentions in chatter posts. I can't get the helper mothod to work. I am getting an error using the example code from the github site.
Dev Guide:
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/connectapi_examples_post_feed_element_mention.htm
Link to helper on github:
https://github.com/forcedotcom/ConnectApiHelper
Code:
Illegal assignment from ConnectApi.FeedElement to ConnectApi.FeedItem
Dev Guide:
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/connectapi_examples_post_feed_element_mention.htm
Link to helper on github:
https://github.com/forcedotcom/ConnectApiHelper
Code:
ConnectApi.FeedItem fi = ConnectApiHelper.postFeedItemWithMentions(Network.getNetworkId(), 'me', 'Hey there {005D00000015tjz}, how are you?');Error Message:
Illegal assignment from ConnectApi.FeedElement to ConnectApi.FeedItem
As per the shared documentation, the second parameter should either be the Id of a group or user or record. Can you supply a valid Id as second parameter and then try?
I checked out the class and found that its return type is set to connectapi.FeedElement instead of connectapi.FeedItem. I have updated your code accordingly:
Make sure you supply the correct chatter group Id or record Id or User Id.
I am implementing chatter post with rich text and inline images. The result of the code is a simple text message. I am able to post the message but I am not viewing the image. Can you please help me with img Id. Acutally I want to attach a badge image. How it can be done??? How to take the img Id?