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.ChatterUsers.setPhoto(communityId, userId, fileUpload);

How can I update avatar in Apex too?

global User createUser(Id portalId, Auth.UserData data){
   //missing userId because it is the first time of log in

I need to set fb/twitter avatar to be used for chatter avatar at the same time in register process.

  • Off-hand, I don't think there's a means of doing this unless it's through each service's API. To do that, you'd probably need to support OAuth logins. If so, you then might be able to use an integration API from a service like Gravitar (used here on SF.SE and many other sites). I'd expect that if you were going to use Twitter or FB, you'd need to do it via their APIs. – crmprogdev Dec 25 '15 at 15:33
  • How are you registering your users? Standard SF page? Visualforce action methods? JS Remoting? – Salesforcesmarty Dec 26 '15 at 9:23
  • thank you guys. i have found the solution for my issue developer.salesforce.com/forums/ForumsMain?id=906F0000000MJEU – nptriet Dec 26 '15 at 16:33

Your Answer

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

Browse other questions tagged or ask your own question.