Play Games

Search This Blog

Friday, April 20, 2018

How to delete photo of a user in salesforce through code.

Apex Code:
public Class RemovePhotoFromUserRecord {
    public static void removePhoto() {
    //Replace 2nd parameter with the required userId. Right now I am doing it for loggedin user
    ConnectApi.UserProfiles.deletePhoto(null,userInfo.getUserId());
   
    }
}

Output: call RemovePhotoFromUserRecord.removePhoto() from anonymous window of developer console.
You may observe the photo gets deleted.

No comments:

Post a Comment