You need to sign in to do that
Don't have an account?
Steve Connelly
How do I change a lightning Component to display the label name instead of the API name?
The AccountTeamMember widget (Lightning Component) displays the Role API Name instead of the Role Label.
How do i change the lightning component so it will display the role label instead of the role API name?
Here is the component code:
How do i change the lightning component so it will display the role label instead of the role API name?
Here is the component code:
<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" controller="AccountTeamHelper"> <aura:handler name="init" value="{!this}" action="{!c.doInit}" /> <aura:attribute name="TeamMembers" type="AccountTeamMember[]" /> <lightning:card title="Account Team" iconName="custom:custom103"> <div style="margin: 0px 5px"> <p class="slds-p-horizontal_small"> <aura:if isTrue="{!v.TeamMembers.length > 0}"> <aura:iteration items="{!v.TeamMembers}" var="member"> <!-- <span style="display: inline-block; margin: 3px;"><lightning:avatar src="{!member.User.SmallPhotoUrl}" alternativeText="(Avatar)" fallbackIconName="standard:avatar" variant="circle" /></span> --> <span><a href="{!'/one/one.app#/sObject/' + member.User.Id + '/view'}">{!member.User.FirstName} {!member.User.LastName}</a> - {!member.TeamMemberRole}</span><br/> </aura:iteration> <aura:set attribute="else"> No account team members have been assigned to this account. </aura:set> </aura:if> </p> </div> </lightning:card> </aura:component>
All Answers
No changes are required in aura component file. You need the changes in AccountTeamMember Soql on Apex class.
Can you please update your soql query in AccountTeamHelpe to access the label of TeamMemberRole as below:
change TeamMemberRole --> toLabel(TeamMemberRole) in SOQL will solve your issue.
Thanks,
Maharajan.C
JS:
Class:
Thanks,
Maharajan.C
Thank you so much for the guidance!
Steve