1

How to display chatter recommendations in custom Visual Force page. I searched for the connect API methods but I can't find the exact one. So please update with the connect API methods.

enter image description here

1

Try ConnectApi.Recommendations.getRecommendationsForUser(). You can set contextAction and contextObjectId to null if you want to replicate the list shown in your screenshot.

| improve this answer | |
  • ConnectApi.Recommendations.getRecommendationsForUser() . method returns ConnectApi.RecommendationCollection type. class has only one property named 'recommendations ' which is of List<ConnectApi.​Abstract​Recommendation> . but i cant create a List<ConnectApi.​Abstract​Recommendation> variable in apex code. In documentation itself they have told that Its not available for 34.0 api version. Is there any work around. – Monish Jul 30 '15 at 12:08
  • If you're referring to developer.salesforce.com/docs/atlas.en-us.apexcode.meta/…, the part about not being available in v34.0 is about the ConnectApi.NonEntityRecommendation class (sorry, it should be clearer in the docs). How are you attempting to create the list? You should be able to say ConnectApi.RecommendationCollection recs = ConnectApi.Recommendations.getRecommendationsForUser(...) and then access all of the properties in "recs". – alouie Aug 1 '15 at 2:00
  • I am creating the list as you have said , but the problem is i cant access the data in it which is of type list< ConnectApi.​Abstract​Recommendation>. Any work around is appreciated – Monish Aug 3 '15 at 4:27
  • You should iterate through the List<ConnectApi.AbstractRecommendation> and then do an "instanceof ConnectApi.EntityRecommendation" check, and then cast it to a ConnectApi.EntityRecommendation if the check is true. If you need more help, please add some sample code to your question along with any error messages you're getting. – alouie Aug 3 '15 at 5:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.