You need to sign in to do that
Don't have an account?
Michael Minnekeer
How to get smallPhotoUrl with standard Owner field and display in lightning component?
I am trying to display the owner chatter picture in a lightning component and I am unsure if this is a second query that should be done in the controller or a helper as I have seen some threads using a function to query it and some using apex however none are asking about this for a lightning component, this was pretty simple on a custom lookup field just the standard owner field has it's limitations and the field is not available in a formula field.
Apex controller:
Apex controller:
public class Case_List_DPI_Controller { @AuraEnabled public static List<Case> getCases() { return [SELECT Id, Subject, CaseNumber, OwnerId, Owner.FirstName, Owner.LastName, Owner.Name, Owner.Email, Case_Life_Days_Business_Days__c, Case_Life_Hours__c, Case_Department__c, RecordTypeId, RecordType.Name, SourceId, Reason, Origin, ClosedDate, CreatedDate, Description, isClosed FROM Case where Case_Department__c = 'Property' AND isClosed = false ORDER BY createdDate DESC ]; } }Component:
<aura:component controller="Case_List_DPI_Controller" implements="flexipage:availableForAllPageTypes" access="global"> <aura:attribute name="cases" type="List" /> <aura:handler name="init" value="{!this}" action="{!c.doInit}" /> <!-- Use a data table from the Lightning Design System: https://www.lightningdesignsystem.com/components/data-tables/ --> <table class="slds-table slds-table--bordered slds-table--striped slds-table--cell-buffer slds-table--fixed-layout"> <thead> <tr class="slds-text-title_caps"> <th> <div title="Open Cases with Property Department">Open Cases with Property Department</div> </th> </tr> <tr class="slds-text-heading--label"> <th scope="col"><div class="slds-truncate" title="B. Days">B. Days Open</div></th> <th scope="col"><div class="slds-truncate" title="Owner">Owner</div></th> <th scope="col"><div class="slds-truncate" title="Type">Type</div></th> <th scope="col"><div class="slds-truncate" title="Subject">Subject</div></th> </tr> </thead> <tbody> <!-- Use the Apex model and controller to fetch server side data --> <aura:iteration items="{!v.cases}" var="case" indexVar="index"> <tr> <td><div class="slds-truncate" title="{!case.Case_Life_Days_Business_Days__c}">{!case.Case_Life_Days_Business_Days__c}</div></td> <td> <div class="slds-truncate"> <span class="data-social-photo-guid-4eded8ac-41d6-4524-ab50-b14d0349f58d photoContainer forceSocialPhoto_v2 forceOutputLookup"> <span class="uiImage"> <img class="smallSocialPhoto circular" src="{!c.Owner.smallPhotoURL}" /> </span> </span> <a onclick="{!c.navigateToUser}" style="width:100%;" data-index="{!index}">{!case.Owner.Name}</a> </div> </td> <td><div class="slds-truncate" title="{!case.RecordType.Name}">{!case.RecordType.Name}</div></td> <td><div class="slds-truncate"><a onclick="{!c.navigateToRecord}" style="width:100%;" data-index="{!index}">{!case.Subject}</a></div></td> </tr> </aura:iteration> </tbody> </table> </aura:component>
give it a try