global  List<ConnectApi.RecommendationCollection> getRecom()
  List< ConnectApi.RecommendationCollection> recom =ConnectApi.Recommendations.getRecommendationForUser(null,'xxxxxxxxx00IbK8','follow','follow');
    return recom ;

I am trying to write code like above but getting error

Compile Error: Method does not exist or incorrect signature: ConnectApi.Recommendations.getRecommendationForUser(NULL, String, String, String) at line 11 column 53

2 Answers 2


The last parameter has to be an Object ID (user ID, file ID, record Id, etc): List values= ConnectApi.RecommendationActionType.values(); getRecommendationForUser(null,'xxxxxxxxx00IbK8',values[0],'follow');


Type: String Specifies the object to take action on.

  • If action is follow, objectId is a user ID, file ID, or record ID.
  • If action is join, objectId is a group ID.
  • If action is view, objectId is a user ID, file ID, group ID, record ID, or custom recommendation ID (version 34.0 and later).

I hope this answer will help you.

  • List<ConnectApi.RecommendationActionType> values= ConnectApi.RecommendationActionType.values(); 'follow'=value[0]
    – Dilip
    Commented Aug 26, 2015 at 6:46

Actually I was passing parameter as string for ConnectedApi.​RecommendationActionType as string it should be like

 List<ConnectApi.RecommendationActionType> values= ConnectApi.RecommendationActionType.values(); 

and pass the value as parameter like value[0] for follow...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .