4

I'm trying to get the user's profile picture to display in a page layout through the use of a formula field (image function). But I can't find the profile picture in the user object. Is it possible at all to make use of the profile pic this way?

1

3 Answers 3

6

You have to use a Visualforce page to display the pic. Here is an example showing the profile pic on an employee record (custom object).

<apex:page standardController="Employee__c">
    <br />
    <apex:image value="{!Employee__c.user__r.FullPhotoUrl}"/> 
</apex:page>
7
  • Thanks but I don't want to change the page layout for a VF page. Any ideas how I can keep the default page layout?
    – Saskiah
    Feb 21, 2016 at 9:50
  • You can use the VF as a component in your page layout. When you've created the page, it shows up in the list of available VF pages in the page layout editor
    – user28311
    Feb 21, 2016 at 10:05
  • It's working! Thanks Fred, will vote for your answer as soon as I have enough credits
    – Saskiah
    Feb 21, 2016 at 10:54
  • This is SO close to what I'd want.... a Formula field with IMAGE() code to pull in their Photo. Any takers? >:-)
    – AMM
    Jan 31, 2017 at 23:16
  • @AMM I'm afraid it's not possible to use the photo url in a formula field. Hence the VF component. Isn't that working for you?
    – user28311
    Feb 1, 2017 at 7:54
1

I am able to get the URL of FullPhoto and SmallPhoto of User as follows:

 select Id,FullPhotoUrl,SmallPhotoUrl from User
0

You can try this way!

  1. Create a custom field.
  2. Write a trigger to populate the custom field using the below query,

    User p = [Select Name, SmallPhotoUrl, FullPhotoUrl From User where Id=:uName];

2
  • what that custom field will contain differently from FullPhotoUrl ? Feb 21, 2016 at 8:58
  • If it is a standard detail page, populating this custom field will help creating a formula. If it is a visfualforce page, then there is no need of the field. Feb 21, 2016 at 9:03

You must log in to answer this question.

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