• alouie_sfdc
  • SMARTIE
  • 694 Points
  • Member since 2013

  • Chatter
    Feed
  • 22
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 0
    Questions
  • 136
    Replies
Dear All,

I have created a customer community where an visualforce page is created to display chatter group funcationality,.
In this page I am displaying Recently Talking about topics using connect API. It works fine, but while writing test class for this I am getting below error message.

System.AssertException: Assertion Failed: No matching test result found for Topics.getRecentlyTalkingAboutTopicsForGroup(String communityId, String groupId). Before calling this, call Topics.setTestGetRecentlyTalkingAboutTopicsForGroup(String communityId, String groupId, ConnectApi.TopicPage result) to set the expected test result.

Here is my code  :-

Apex Class :-
 
public ConnectApi.TopicPage feedItemPage{get;set;}

public CommunityGroupPage()
 {
   // Chatter Group Id
   Id groupid = apexpages.currentpage().getparameters().get('id');

   / pull all chatter groups, faster than individual queries + 1 SOQL
   chatterGroups = [SELECT id, Name, NetworkId FROM CollaborationGroup where id =: groupid Limit 1];
   String comid;
   String grpid;
   if(chatterGroups.Size() > 0)
   {
   comid = chatterGroups[0].NetworkId;
   grpid = chatterGroups[0].Id;   
   }
   
   //This will be used to fetch Recently Talking about topics for current chatter group
   feedItemPage = ConnectApi.Topics.getRecentlyTalkingAboutTopicsForGroup(comId,grpid);
   
 }

Test Class
 
**
 * An apex page controller that exposes the Chatter Group Page functionality
 */
@IsTest global with sharing class CommunityGroupPageTest {
    @IsTest(SeeAllData=true) global static void testCommunityGroupPage () {
        // Instantiate a new controller with all parameters in the page

   Network community;
   String communityId;

   Id currentUserId = UserInfo.getUserId();    
        User usr = [select id,Name from User where id =: currentUserId];
        
        System.runAs(usr) {
        community = [SELECT id, Name,OptionsReputationEnabled FROM Network where name =: 'Customer Community'];
        communityId = community.id;
        
        collaborationgroup cg = new collaborationgroup(name ='ChatterGroupPage',CollaborationType='Public',OwnerId=currentUserId,NetworkId=communityId);
        insert cg;
        
       PageReference pageRef = Page.CommunityChatterPage;
        Test.setCurrentPage(pageRef);//Applying page context here
        // Add parameters to page URL
        ApexPages.currentPage().getParameters().put('id', cg.id);//Observe how helpful it was to set the parameters in your page from Unit test 
        
        CommunityGroupPage controller = new  CommunityGroupPage ();
        
        controller.groupid = System.currentPagereference().getParameters().get('id');

        ConnectApi.TopicPage testPage = new ConnectApi.TopicPage();
        List<ConnectApi.Topic> testItemList = new List<ConnectApi.Topic>();
        testItemList.add(new ConnectApi.Topic());
        testItemList.add(new ConnectApi.Topic());
                
        testPage.topics = testItemList;

        ConnectApi.Topics.setTestGetRecentlyTalkingAboutTopicsForGroup(communityId, cg.id, testPage);
        ConnectApi.Topics.getRecentlyTalkingAboutTopicsForGroup(communityId,cg.id); 

        }
}
}

Please help me to fix this issue.

Thanks,
AMit Singh
I see
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/connectapi_examples_define_post_action_link.htm
Above link code works for me to post to API.
http://salesforce.stackexchange.com/questions/69472/ui-actionlink-to-salesforce1-custom-visualforce-page

but this only posts to API and second link does not have complete sample.
I need a sample code that opens up another apex page.
I tried but it gives error
// Create the action link definition.
actionLinkDefinitionInput.actionType = ConnectApi.ActionLinkType.Api; (I need this to be Ui)
actionLinkDefinitionInput.actionUrl = '/services/data/v33.0/chatter/feed-elements';
actionLinkDefinitionInput.headers = new List<ConnectApi.RequestHeaderInput>();
actionLinkDefinitionInput.labelKey = 'Post';
actionLinkDefinitionInput.method = ConnectApi.HttpRequestMethod.HttpPost;
actionLinkDefinitionInput.requestBody = '{\"subjectId\": \"me\",\"feedElementType\": \"FeedItem\",\"body\": {\"messageSegments\": [{\"type\": \"Text\",\"text\": \"This is a test post created via an API action link.\"}]}}';
actionLinkDefinitionInput.requiresConfirmation = true;
 
Is there a way to  filter a chatter feed by group id and user id using the Chatter API?  I want to pull just a specific user's posts out of a group feed.
Hello Gurus,

I am trying to utilise the REST API Chatter services within my salesforce Oragnisation. I am new to Salesforce and i am not sure how to access the function defined and send parameters to those Chatter services using REST request.  I blindly tried couple of steps using RESTful HTTP request from Salesforce but i am getting an error. Need your assistance on how to start and tackle this.

Thanks for your help! 

Regards,
Raja
I'm trying to get emails of all group members in a given group. I can request for all members in the group, but the users comes without the email field.

Im using this endpoint: /chatter/groups/GROUP_ID/members

Is there any way to recover all user emails inside a chatter group?
Hi,

Is there any way to control the Feed Tracking entries populated by Chatter?
Allow me to elaborate my problem. At the moment, when we have Feed Tracking in a custom object (say Test__c) for a field (FieldName__c) , when there is a change in the field value, it posts a Feed in Chatter saying 'FieldName changed from X to Y'. I wanted to customize this message if possible. 

While Chatter Triggers on FeedItem would allow me control messages entered by users manually I couldn't find a way to control this feed. 
Is there any way to do this? If not, do you have any workaround for this which might work?

Thanks!
While trying to compile the following test class I am getting a compilatio error Compilation error: Expecting a colon, found ',' at this particular line in the code 

ConnectApi.FeedElementPage Leadpost = ConnectApi.ChatterFeeds.getFeedElementsFromFeed(null, ConnectApi.​FeedType.Record, TestLead1.id, null, 5, CreatedDateDesc);

Can anyone help me to get rid of this.
 
@isTest(seeAllData=true)
private class TestLeadContactFeedTrigger {

    static testmethod void initTest(){
        Profile p = [SELECT Id FROM Profile WHERE Name='Standard User'];
         
        User u = new User(Alias = 'TLCFT', 
                          Email='TLCFTest@test.com', 
                          EmailEncodingKey='UTF-8', 
                          LastName='Testing', 
                          LanguageLocaleKey='en_US', 
                          LocaleSidKey='en_US', 
                          ProfileId = p.Id, 
                          TimeZoneSidKey='America/Los_Angeles',
                          UserName='TLCFTest@test.com');
        insert u;
        System.debug('User created: ' + u.Id);
                          
        Lead TestLead1 = new Lead(FirstName = 'Test',
                                  LastName = 'Lead1',
                                  Company = 'Test Comp1',
                                  Status ='Working-Contacted',
                                  Email ='test.lead1@test.com',
                                  OwnerId = u.Id,
//                                OwnerId = '005K0000002N5GT',
                                  Lead_Info__c = 'This is the Lead Info for a test lead John Doe1');
        insert TestLead1;
        
        ConnectApi.FeedElementPage Leadpost = ConnectApi.ChatterFeeds.getFeedElementsFromFeed(null, ConnectApi.​FeedType.Record, TestLead1.id, null, 5, CreatedDateDesc);
                
         System.assertEquals('This is the Lead Info for a test lead John Doe1', TestLead1.Lead_Info__c);
    }
}


 
It is possible to get or construct the URL of an image in a Feed Attachment?  I tried using just the record ID, but that calls up the entire Files page.  I need the URL directly of the image.  The app I want to use this with runs inside of Salesforce so I don't think I need to be concerned with authentication.  Thanks.

When I retrieve data for Chatter I do not get data on any files/images attached to a comment.

 

I get

 

parent {id  and url}
id
clientinfo
user{name, title,companyName, firstName, lastName,mySubscription, isChatterGuest, photo (large and small}, id, url, type}
body{text, messageSegments}, feedItem, deletable, url, createdDate

 

 

Am I missing something or is this by design?

  • December 06, 2013
  • Like
  • 0

Hello !!! Very much new to chatter ;) still was going through editing my profile and I found that any small change made to the profile is been reflected on my post in my profile and highlighted to all which is not necessary ( Ex when I add a city in my profile which isnt mandatory sometimes to show that to all ) .

So do we have any option to delete or do we have any option to hide !

  • November 28, 2013
  • Like
  • 0

I logged into chatter app using my credential. When I tried to open another user's feeds using following REST API

 

/services/data/v28.0/chatter/feeds/news/005i0000001lc4X/feed-items

 

where  005i0000001lc4X is that user's Id, I got error message saying:

 

HTTP/1.1 403 Forbidden Date: Wed, 20 Nov 2013 07:31:38 GMT Content-Type: application/json;charset=UTF-8 Transfer-Encoding: chunked
[ { "message" : "You do not have permission to execute that operation.", "errorCode" : "INSUFFICIENT_ACCESS" } ]

 

Any idea why? Because I am following this user, I should be able to view his news feeds, right?

 

Thanks in advance!

 

 

 

 

How do I create a Chatter Post that looks like this?

 


What I want to do is, have a trigger that calls a function to create a chatter post when a new contact is created. I want it to look like the image below. Right now, I have a trigger on 'Contact' that calls a function, but I'm not sure of how to create a Chatter FeedItem that looks like this.

 

Sample Chatter Post


Is there a certain FeedItem Type that will do this?
Or is there a way for me to add style to the FeedItem?

Hello,

 

I'm running into a roadblock when trying to login as a Customer Community User and access the Chatter REST API via our Connected App.

 

I'm able to get in and access the API no problem with a System Administrator user type. However for a Customer Community User, it looks like they give me access but I can't get any queries to return data.

 

I successfully OAuth and get an access token but when making the request I get the error:

"The Chatter Connect API is not enabled for this organization or user type."

 

I've created a Permission Set for the Customer Community User to have "API Enabled" and added that to the Connected App.

I've tried OAuth'ing via user-agent and web-server and for both, the tokens I get do not work. When using web-server, the code I get back does work to get the access token, but again the token is not valid.

 

Am I forgetting something in the header that is needed for non-Sys Admin users?

 

More info on my process:

Auth code url:

https://app-comm-test-developer-edition.na15.force.com/comm1/services/oauth2/authorize?response_type=code&client_id={our connected app's client id}&redirect_uri=https://login.app-comm-test-developer-edition.na15.force.com/services/oauth2/success

After login, with the code given back, I send a request to:

https://app-comm-test-developer-edition.na15.force.com/comm1/services/oauth2/token

This grants me an access token, which I then include in the header as {'Authorization' : 'OAuth <token>'} to:

https://app-comm-test-developer-edition.na15.force.com/comm1/services/data/v29.0/connect/communities/0DBi0000000CavRGAS/chatter/feeds/news/me/feed-items

 

This is where I get the error message: "The Chatter Connect API is not enabled for this organization or user type."

If I replace the access token with one given to me when logging in as a System Administrator, things work fine.

 

Any insight on steps I'm missing are greatly appreciated!

 

Cheers,

Victor

Hi. I'm using the chatter connect to create a chatter post.

Ref: Connect

 

All works fine but i want to specify the user that creates the chatter post.

In the previous version of my code, i don't use the connect and i have the following instruction:

 testpost.CreatedById=user.id; 

 

Do you know how i can do this in the connect api chatter?

My class:

Global class HappyBirthdayRandomPilot implements Schedulable{
//FOR TEST METHOD
   public static String CRON_EXP = '0 0 0 3 9 ? 2022';
   
  Global void execute(SchedulableContext sc) 
    {

            
           // SEARCH BY STATIC RESOURCE NAME
           List<StaticResource> Pictures=[Select Name, ContentType, Body From StaticResource where Name like 'PicturehappyBirthday%'];
           // IS THE USER BIRTHDAY?              
           List<user> lstu=[SELECT id,name,date_of_birth__c FROM user WHERE  CALENDAR_MONTH(date_of_birth__c)=:date.today().month() AND  DAY_IN_MONTH(date_of_birth__c)=:date.today().day()];
           CollaborationGroup group=[Select id,name from CollaborationGroup where Name like 'name%' limit 1];
                     
           //String communityId = null;
             
             
              for(User u:lstu)
              {
                //GENERATE A RANDOM NUMBER [0-5] TO SELECT THE PICTURE
                   Integer choice=math.mod(Integer.valueof(Math.random()*100),6);
                   Blob Decodedbody=Pictures[choice].body;

                // CREATE A FEED_ITEM_TEXT 
                    ConnectApi.MessageBodyInput messageInput = new ConnectApi.MessageBodyInput();
                    messageInput.messageSegments = new List<ConnectApi.MessageSegmentInput>();
                    ConnectApi.TextSegmentInput textSegment = new ConnectApi.TextSegmentInput();
                    textSegment.text = 'Happy birthday to ';
                    messageInput.messageSegments.add(textSegment);
                    ConnectApi.MentionSegmentInput mentionSegment = new ConnectApi.MentionSegmentInput();
                    mentionSegment.id = u.id;
                    messageInput.messageSegments.add(mentionSegment);
                    textSegment = new ConnectApi.TextSegmentInput();
                    textSegment.text = '!';
                    messageInput.messageSegments.add(textSegment);
                    ConnectApi.FeedItemInput input = new ConnectApi.FeedItemInput();
                    input.body = messageInput;

                // POST FILE_FEED_ITEM
                    ConnectApi.NewFileAttachmentInput fileIn = new ConnectApi.NewFileAttachmentInput();
                    fileIn.title ='Wishes!'; 
                    fileIn.description = '';
                    Input.attachment = fileIn;
                    string contentType='image/jpeg';
                    ConnectApi.BinaryInput feedBinary = new ConnectApi.BinaryInput(Decodedbody,contentType, 'Wishes!.jpg');
                    
                // PARAMETERS(communityId, feedType, subjectId, input,filebody);
                    ConnectApi.ChatterFeeds.postFeedItem(null,ConnectApi.FeedType.Record,group.id,Input, feedBinary);
                
              }
        }
    }

 

Thanks in advantage for any advice.

BR.

 

 

 

 

 

 

 

  • June 19, 2013
  • Like
  • 0

Greetings, I'm wondering if someone can explain how this works. I'm calling feed-items from a specific group and I'd like to redirect the user of the app I'm building to the specific group page or feed-item page on clicking the text (if there is one for individual feed items).

 

I get things back like   "url" : "/services/data/v23.0/chatter/feed-items/0D5C0000017QoVpKAK", but I'm not sure how to format that so it loads the chatter site for the user. Using the instance_url and then that url section doesn't work, but I'm hoping the feed-item ID can be used or something.. Just ignorant of the format to use.

 

Hope that makes sense. Thanks!

Hi,

using apex code in salsesForce

CollaborationGroup gp = [Select OwnerId, Id From CollaborationGroup Where Name = 'Group_ReadOnly'];

 

how to get the list of managers of a group?

Thx.

It looks like in Communities it's not possible for the communities user to decide if they want to auto follow records they create, so I'm trying to use a trigger to accomplish the same goal.

 

The code I've written (stolen) from other places in the forums works great for internal users.... but for community users creating the same type of record, it throws back an error.

 

I'm pretty sure the problem is the: Userinfo.getUserId()  

Anyone get that working in Chatter Communities yet?

 

Here's the code:

 

trigger AutoFollow on Projects__c (after insert) {

Id aid = [Select Id from Projects__c Order By CreatedDate Desc limit 1].id;
EntitySubscription es = new EntitySubscription();
es.ParentId = aid;
es.SubscriberId = Userinfo.getUserId();
insert es;

}

 

Here's the error:

INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, This person’s information is private because they’re not a member of the community.

Hello,

 

Trying to post a file using the REST API gives an error:

<?xml version="1.0" encoding="UTF-8"?><Errors><Error><errorCode>MISSING_ARGUMENT</errorCode><message>No attachment found and body is empty. Provide a non-empty &apos;text&apos; parameter, or a rich input including non-empty message segments. If providing rich JSON/XML input in REST, make sure to include Content-Type header. In multipart REST, include the Content-Type in the part.</message></Error></Errors>

 

The content of my request is the one taken from the documentation [full request on the bottom of this post]:

http://www.salesforce.com/us/developer/docs/chatterapi/Content/intro_input.htm#cc_upload_binary_files

 

I tried the json, older version of the API (V27.0), got the same messages. Since I had this error in my implementation, I tried using a Chrome extension called ‘Advanced REST Client’ and got the same message so obviously I'm doing something wrong or the request has a problem.

 

Now, the id I'm using here is from a custom object that has Feeds. If I'm posting a standard Text post/comment to it , all is working correctly, but file uploads are not working. Since I'm taking the exact documentation sample, it seems weird.

 

Any thoughts ?

 

--- Full request below

 

POST /services/data/v27.0/chatter/feeds/record/a0tg00000008sFFAAY/feed-items HTTP/1.1
Host: weforum--r4dev.cs17.my.salesforce.com
Connection: keep-alive
Content-Length: 951
Cache-Control: no-cache
Pragma: no-cache
Accept: application/xml
Origin: chrome-extension://hgmloofddffdnphfgcellkdfbfbjeloo
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.94 Safari/537.36
Authorization: OAuth 00Dg00000005EHf!ARIAQJry9BazRT_G1jw_nQBm_kN990VDYK87S_xsJ6MS3dTb5UNnlJVcJF72psrBQ8H1LtZPlSLCkmlZuf2GxGBNYoia4ECS
Content-Type: multipart/form-data, boundary=0HWq8x4y4DSQ4fqjXt6MinVMyqbf1r
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8

--0HWq8x4y4DSQ4fqjXt6MinVMyqbf1r
Content-Disposition: form-data; name="xml"
Content-Type: application/xml; charset=UTF-8

<feedItem>
   <body>
      <messageSegments>
         <segment>
            <text>High priority content </text>
            <type>Text</type>
         </segment>
         <segment>
             <tag>important</tag>
            <type>Hashtag</type>
         </segment>
         <segment>
            <text>Please review this as soon as possible</text>
            <type>Text</type>
         </segment>
      </messageSegments>
   </body>
   <attachment attachmentType="NewFile">
      <description>Quarterly review 2012 Q1</description>
      <title>2012_q1</title>
   </attachment>
</feedItem>

--0HWq8x4y4DSQ4fqjXt6MinVMyqbf1r
Content-Disposition: form-data; name="feedItemFileUpload"; filename="foo"
Content-Type: application/octet-stream; charset=ISO-8859-1

This is the content of the file.
--0HWq8x4y4DSQ4fqjXt6MinVMyqbf1r--
 

 

 

Hello,

 

I am attemping to create a warning email via apex class.

And I got a sample from internet for that.

 

But when I try that in my environment, I keep getting the error info "Save error: unexpected token: ')' ".

 

Is there any idea for this?

 

 

Detail script as below, and I marked the error line in red color.

 

public with sharing class Email_Reminding {

 

User USR = [Select id from User limit 1];
EmailTemplate et = [Select id from EmailTemplate where name= 'EmailTemplatename'];
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
mail.setTargetObjectId(USR.Id);
mail.setSenderDisplayName('Jason Fang');
mail.setTemplateId(et.id);
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });

}

 

Thanks a lot.

 

is there a way in the chatter api to get the feed of a specific group?

 

for example,

 

/services/data/v28.0/chatter/feeds/groups/{group id}/feed-items

(where {group id} is the id of the group - either the sobject id, or the id obtained from the result of /services/data/v28.0/chatter/groups)

 

gives an "invalid subject identifier" error.

 

is there a way to get this without resorting to soql queries?

  • May 14, 2013
  • Like
  • 0
Hello,

I am trying to write Unit Tests for the following code snippet:
 
// find topics matching the word "Cancer"
String query = 'Cancer';
ConnectApi.TopicPage page = ConnectApi.Topics.getTopics(Network.getNetworkId(), query, ConnectApi.topicSort.PopularDesc);
This code works fine when actually in use via my application or via Anonymous Apex, but fails to return any results in my unit test:
@isTest(SeeAllData=true)
	static void testTopicsWithMatches() {


		ConnectApi.CommunityPage cp = ConnectApi.Communities.getCommunities();

		if( cp == null || cp.communities == null || cp.communities.isEmpty() ) {
			System.assert( false, 'Unable to locate community!' );
		}

		ConnectApi.Community myCommunity = cp.communities.get( 0 );


		Test.startTest();

		ConnectApi.TopicPage topicPage = ConnectApi.Topics.getTopics( myCommunity.Id, 'Cancer', ConnectApi.topicSort.PopularDesc );
		System.debug( topicPage);
		System.debug( '-----' + topicPage.topics );

		Test.stopTest();
}
Even with the SeeAllData=true, the returned ConnectApi.TopicPage has no topics. Why is this? Do I need to set mock results for the ConnectApi somehow? If so, using which set method?

Any guidance is appreciated, thanks.
Dear All,

I have created a customer community where an visualforce page is created to display chatter group funcationality,.
In this page I am displaying Recently Talking about topics using connect API. It works fine, but while writing test class for this I am getting below error message.

System.AssertException: Assertion Failed: No matching test result found for Topics.getRecentlyTalkingAboutTopicsForGroup(String communityId, String groupId). Before calling this, call Topics.setTestGetRecentlyTalkingAboutTopicsForGroup(String communityId, String groupId, ConnectApi.TopicPage result) to set the expected test result.

Here is my code  :-

Apex Class :-
 
public ConnectApi.TopicPage feedItemPage{get;set;}

public CommunityGroupPage()
 {
   // Chatter Group Id
   Id groupid = apexpages.currentpage().getparameters().get('id');

   / pull all chatter groups, faster than individual queries + 1 SOQL
   chatterGroups = [SELECT id, Name, NetworkId FROM CollaborationGroup where id =: groupid Limit 1];
   String comid;
   String grpid;
   if(chatterGroups.Size() > 0)
   {
   comid = chatterGroups[0].NetworkId;
   grpid = chatterGroups[0].Id;   
   }
   
   //This will be used to fetch Recently Talking about topics for current chatter group
   feedItemPage = ConnectApi.Topics.getRecentlyTalkingAboutTopicsForGroup(comId,grpid);
   
 }

Test Class
 
**
 * An apex page controller that exposes the Chatter Group Page functionality
 */
@IsTest global with sharing class CommunityGroupPageTest {
    @IsTest(SeeAllData=true) global static void testCommunityGroupPage () {
        // Instantiate a new controller with all parameters in the page

   Network community;
   String communityId;

   Id currentUserId = UserInfo.getUserId();    
        User usr = [select id,Name from User where id =: currentUserId];
        
        System.runAs(usr) {
        community = [SELECT id, Name,OptionsReputationEnabled FROM Network where name =: 'Customer Community'];
        communityId = community.id;
        
        collaborationgroup cg = new collaborationgroup(name ='ChatterGroupPage',CollaborationType='Public',OwnerId=currentUserId,NetworkId=communityId);
        insert cg;
        
       PageReference pageRef = Page.CommunityChatterPage;
        Test.setCurrentPage(pageRef);//Applying page context here
        // Add parameters to page URL
        ApexPages.currentPage().getParameters().put('id', cg.id);//Observe how helpful it was to set the parameters in your page from Unit test 
        
        CommunityGroupPage controller = new  CommunityGroupPage ();
        
        controller.groupid = System.currentPagereference().getParameters().get('id');

        ConnectApi.TopicPage testPage = new ConnectApi.TopicPage();
        List<ConnectApi.Topic> testItemList = new List<ConnectApi.Topic>();
        testItemList.add(new ConnectApi.Topic());
        testItemList.add(new ConnectApi.Topic());
                
        testPage.topics = testItemList;

        ConnectApi.Topics.setTestGetRecentlyTalkingAboutTopicsForGroup(communityId, cg.id, testPage);
        ConnectApi.Topics.getRecentlyTalkingAboutTopicsForGroup(communityId,cg.id); 

        }
}
}

Please help me to fix this issue.

Thanks,
AMit Singh
Hello Eveyone,

I have to get the all the messages with the same converarstionhappening in chatter messgaes by using the ConnectAPI. Whenver we click on the messges under the recent message came it expands and display all the messges within that chain.  

Please provide me the method that is used for getting the messges realeted to that chain.
User-added imageUser-added image

When we click on the box written as 7:22 AM in screen 1, it expand and become screen 2. How to get the all the messages by using connectApi
Thanks,
Sunil
  1. When case is created from partner Community User(Partner Communtity Profile), I'm creating record in FeedItem,
  2.         FeedItem fi = new FeedItem();
            fi.Body = 'Feed Body';
            fi.ParentId = '5003000000D8cuI';
            fi.Visibility = 'AllUsers';
            fi.NetworkScope = 'AllNetworks';  
        
            Insert fi;

        3. Now i want this feed to be shown to Chatter Free User who is having "Chatter Free License".

How can i show this Feed to ChatterUser?
Any Approaches/Workarounds.
 
  • September 30, 2015
  • Like
  • 0
I created a custom chatter feed via apex code that shows up approve reject buttons, its showing up in browser but not in chatter desktop.
 
The code works but buttons show up only in browser-
actionLinkDefinitionInput.actionType = ConnectApi.ActionLinkType.Ui;
actionLinkDefinitionInput.actionUrl = 'https://test123567.na24.visual.force.com/apex/popuppage';
actionLinkDefinitionInput.labelKey = 'Approve';
actionLinkDefinitionInput.method = ConnectApi.HttpRequestMethod.HttpGet;
actionLinkDefinitionInput.requiresConfirmation = true;
 
// To Do: Substitute an OAuth value for your Salesforce org.
requestHeaderInput1.name = 'Authorization';
requestHeaderInput1.value = 'OAuth 00DD00000007WNP!ARsAQCwoeV0zzAV847FTl4zF.85w.EwsPbUgXR4SAjsp';
//actionLinkDefinitionInput.headers.add(requestHeaderInput1);
 
requestHeaderInput2.name = 'Content-Type';
requestHeaderInput2.value = 'application/json';
//actionLinkDefinitionInput.headers.add(requestHeaderInput2);
 
// Add the action link definition to the action link group definition.
actionLinkGroupDefinitionInput.actionLinks.add(actionLinkDefinitionInput);
 
actionLinkDefinitionInput1.actionType = ConnectApi.ActionLinkType.Ui;
actionLinkDefinitionInput1.actionUrl = 'https://test123567.na24.visual.force.com/apex/popuppage';
actionLinkDefinitionInput1.labelKey = 'Reject';
actionLinkDefinitionInput1.method = ConnectApi.HttpRequestMethod.HttpGet;
actionLinkDefinitionInput1.requiresConfirmation = true;
actionLinkGroupDefinitionInput.actionLinks.add(actionLinkDefinitionInput1);
// Instantiate the action link group definition.
ConnectApi.ActionLinkGroupDefinition actionLinkGroupDefinition = ConnectApi.ActionLinks.createActionLinkGroupDefinition(Network.getNetworkId(), actionLinkGroupDefinitionInput);
 
User-added image
I see
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/connectapi_examples_define_post_action_link.htm
Above link code works for me to post to API.
http://salesforce.stackexchange.com/questions/69472/ui-actionlink-to-salesforce1-custom-visualforce-page

but this only posts to API and second link does not have complete sample.
I need a sample code that opens up another apex page.
I tried but it gives error
// Create the action link definition.
actionLinkDefinitionInput.actionType = ConnectApi.ActionLinkType.Api; (I need this to be Ui)
actionLinkDefinitionInput.actionUrl = '/services/data/v33.0/chatter/feed-elements';
actionLinkDefinitionInput.headers = new List<ConnectApi.RequestHeaderInput>();
actionLinkDefinitionInput.labelKey = 'Post';
actionLinkDefinitionInput.method = ConnectApi.HttpRequestMethod.HttpPost;
actionLinkDefinitionInput.requestBody = '{\"subjectId\": \"me\",\"feedElementType\": \"FeedItem\",\"body\": {\"messageSegments\": [{\"type\": \"Text\",\"text\": \"This is a test post created via an API action link.\"}]}}';
actionLinkDefinitionInput.requiresConfirmation = true;
 

I have to test cover this line: 
ConnectApi.FeedItemPage items = ConnectApi.ChatterFeeds.getFeedItemsFromFeed(null, ConnectApi.FeedType.News, 'me');
Here is my test class:

@isTest private class NewsFeedClassTest {
@IsTest static void doTest() {
// Build a simple feed item
ConnectApi.FeedItemPage testPage = new ConnectApi.FeedItemPage();
List<ConnectApi.FeedItem> testItemList = new List<ConnectApi.FeedItem>();
testItemList.add(new ConnectApi.FeedItem());
testItemList.add(new ConnectApi.FeedItem());
testPage.items = testItemList;
}
}

This works fine with Version 30, but whenever I change to version 34 of apex it givers deprecated property error, any one knows how to test cover the following lines of code??

Thanks & Regards,

Ajay

Use Case:
We notify our sales organization whenever there is an issue with one of their customers. Right now this is done with email distribution lists. The service organization sends an email with the relevant information and sends updates (email replies) as the situation changes. We would like to move this communication to Chatter.

Current Solution:
We have established a Chatter group for every Sales territory. We are using ‘Group Alerts for Chatter’ app. When a Service agent working on a Case wants to send a notification to a Chatter group, the agent selects a check box on the Case which pulls all the relevant fields out of the Case to route the post to the appropriate Chatter group based on the territory of the Account.
 
Challenges:
#1. Additional comments to the post do not send email notifications. Is there a way this can be done?
#2. In some instances we would like to post to multiple chatter groups. We can do this easily with ‘Group Alerts for Chatter’. The challenge is we don’t want the support agent to have to update posts in 2 chatter groups. Is there a way to set up a dynamic post that gets updated in both places when comments are added?

Any help and ideas to address the challenges would be much appreciated!

Need some help creating a trigger that prevents users from leaving a company wide chatter group. Does anyone have some code they could share? 
Is there an object in Salesforce that I can query and/or run DML statements against to retrieve and create Chatter bookmarks for users?
I'm trying to get feed items through paging, but the next page always returns a 400 bad request error...  the flow seems pretty basic, not sure what's wrong with the subsequent request but any help\ideas are appreciated. Thanks, Joan

INITIAL REQUEST:
    https://na6.salesforce.com/services/data/v29.0/chatter/feeds/record/0F9800000000266CAA/feed-items

EXCERPT FROM RESPONSE:
"nextPageUrl" : "/services/data/v29.0/chatter/feeds/record/0F9800000000266CAA/feed-items?page=2014-02-06T04%3A52%3A11Z%2C0D580000013UegyCAC"

REQUEST FOR NEXT PAGE RETURNS 400 ERROR:
    https://na6.salesforce.com/services/data/v29.0/chatter/feeds/record/0F9800000000266CAA/feed-items?page=2014-02-06T04%3A52%3A11Z%2C0D580000013UegyCAC
  • April 02, 2014
  • Like
  • 1