I have a problem when I trigger on the User object: I can't get the profile photo url.

On this simple code I made a trigger to an User update and I send me by mail the fields FirstName LastName and MediumPhotoUrl from the updated user.

I get FirstName and LastName well but impossible to get MediumPhotoUrl (null), I don't understand why I can't access this field.

In a classic Apex class I can do [SELECT Id, MediumPhotoUrl from User etc...] So I don't know why I can't access to this field here ?

Do you have any idea ?

Thank you

trigger UpdateUserToSendBird on User (before update) {

    for(User usr : Trigger.new) {       
        User oldUser = Trigger.oldMap.get(usr.Id);

        if(oldUser.SendBird_Synchro__c == true){

            String userId = usr.Id;
            String userName = usr.Name;
            String total = 'Name = '+usr.FirstName+ ' '+usr.LastName + ' photo = '+usr.FullPhotoUrl + ' ' + usr.MediumBannerPhotoUrl + ' ' + usr.BannerPhotoUrl + ' '+usr.SmallPhotoUrl;
            EmailManagerBis.sendMail('[email protected]', 'test update',total );



            system.debug('Not sendbird User');

EDIT : When I update a classic field on the user profile (first name, last name, AboutMe, ...) it launches the trigger. However, when I update the profile picture or the banner, the trigger does not launch, as if these 2 fields were not part of the User object, or as if modifying the photos is not considered as an update

Updated code to test other fields, result :

Result trigger

2 Answers 2


It appears to me that your trigger may be using the incorrect field. According to the Object Reference for User, there are 5 possible fields that a user photo can be held in, the most important one being the FullPhotoURL. Here are the names of all the fields:

  • BannerPhotoUrl: The URL for the user's banner photo. (API 36 & later)
  • FullPhotoUrl: The URL for the user's profile photo.
  • MediumBannerPhotoUrl: The URL for the medium sized user profile banner photo.
  • SmallBannerPhotoUrl: The URL for the small user profile banner photo.
  • SmallPhotoUrl: The URL for a thumbnail of the user's profile photo.


In response to comments...

I've looked at your code again and I see that your trigger doesn't use the correct field name for a Medium Photo. The correct field to use is MediumBannerPhotoUrl. I recommend you at least TRY changing the code in your trigger to see if it resolves your issue.

  • Thank you for your response. Unfortunately I had already tested all those fields, with the same result : null (I should have mentioned that). The MediumPhotoUrl is also correct, I use it in several Apex Classes Jul 24, 2018 at 12:57
  • @FlorianJoubert I had meant to mention that about 1-1/2 years ago sharing was added to the User Object. Check your OWD to see what they are and whether that might be affecting your trigger and your results.
    – crmprogdev
    Jul 24, 2018 at 14:48
  • @ crmprogdev I had already tested thoses field, but I have updated the code and the result in my post. The MediumPhotoUrl is correct, it's in my User Object with the label : "Url for medium profile photo" as I want to get the profile picture of an user. But I tried all photos fields. I think the problem is how thoses (pictures) fields can be read in a trigger and why they react differently from other fields ? Jul 25, 2018 at 7:41
  • @FlorianJoubert I recommend you create a unit test method to help you determine why this isn't working for you. By creating the test data yourself and using different RunAs users (not just an Admin) and also testing different "types" of users, you should be able to better isolate the source of the issue.
    – crmprogdev
    Jul 28, 2018 at 14:42

Did you eventually find a solution for this?

According to this article here https://issues.salesforce.com/issue/a028c00000gAzbSAAS/fullphotourl-mediumphotourl-and-smallphotourl-field-values-on-user-object-coming-as-null-when-trying-to-use-in-flow-trigger-process-builder the workaround would be using apex as flows/process builder also retrieved a null value.

However I'm encountering the same as in the OP: -Trigger doesn't fire even though MediumPhotoURL/FullPhotoURL/... has been changed. You can tell by the LastModifiedDate on the user record that Salesforce does not track any changes to these fields as record updates. -Secondly when retrieving the value for e.g. MediumPhotoURL, it gets retrieved as null

You must log in to answer this question.

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