function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Diederik VerstraeteDiederik Verstraete 

Enable User Profile Pic in custom component (lightning:outputField) ?

How can I add the small User Profile Picture when I referrence the OwnerID via 

<lightning:outputField fieldName="OwnerId" />

Currently, I only get the Name. I want it to be like on any other page: the photo + name. 

OwnerID without profile pic
I want it like this:
owner name with picture

My current code is:
 

<aura:component implements="force:hasRecordId,forceCommunity:availableForAllPageTypes">
  <aura:attribute name="recordId" type="Id"/>

<lightning:layout>
<lightning:layoutItem size="6" padding="around-small">
 <lightning:recordViewForm recordId="{!v.recordId}" objectApiName="cxsrec___cxsPosition__c">
 
<lightning:outputField fieldName="OwnerId" />
 
</lightning:recordViewForm>            
</lightning:layoutItem>
</lightning:layout>
</aura:component>
This component is used inside an accordeon Section:
<lightning:accordion>
            <lightning:accordionSection label="Label1">
                <aura:set attribute="body">
                    <my component>
                </aura:set>
            </lightning:accordionSection>                    
</lightning:accordion>

 

Shruti VishShruti Vish
Hi Diederik Verstraete,

I hope below code can resolve your issue.

 <lightning:icon iconName="action:user" alternativeText="User" /> 
 
Diederik VerstraeteDiederik Verstraete

Shradha Ys, 

This code will add a fixed image, not dynamic based on the value of OwnerID. 
Do you know maybe another solution?

Diederik VerstraeteDiederik Verstraete
Anyone?