1 Reply Latest reply on Dec 14, 2017 12:51 PM by Adi Leibowitz

    How to Update Profile Picture from Active Directory

    Lior Lavi
      Share This:

      Hello everyone,

      I'm struggling to find a way to import the image store in the thumbnail attribute in Active Directory to our Remedyforce users' profile picture without using 3rd party software.

      Can anyone please help me? I searched all over the place but the only remote option I found was using the Chatter API which I'm not sure how to.

       

      Thank you in advance,

      Lior.

        • 1. Re: How to Update Profile Picture from Active Directory
          Adi Leibowitz

          1. Create a new "Long Text Area" field on the User object

           

           

          2. In Pentaho, map the thumbnailPhoto LDAP field to the custom field you have just created

           

          3. Use something like the code below to generate Chatter Profile Photos for each user (not tested in production, use at your own risk, etc etc)

           

           

          trigger updateUserPhoto on User (after update) {
          Blob userPicBlob;
            ConnectApi.BinaryInput userPhotoBinInput;
            for (User currUser : Trigger.new){
            if (!String.isBlank(currUser.userPicHexString__c))
            {
            userPicBlob = EncodingUtil.convertFromHex(currUser.userPicHexString__c);
            userPhotoBinInput = new ConnectApi.BinaryInput(userPicBlob,'image/jpg','userPhoto.jpg');
            ConnectApi.UserProfiles.setPhoto('internal', currUser.Id, userPhotoBinInput);
            }
            }
          }

           

          1 of 1 people found this helpful