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
mahesh p 54mahesh p 54 

i need to update lightning button icon variant to brand in the component if the object picklist has those values

I have a picklist called Amenities which has following values: parking,wifi,restaurant,playground,garden in the Property (custom) object.If the picklist has wifi value in property record object i need to display wifi lightning button icon variant to brand in lightning component for particular property record.
<aura:component implements="lightning:actionOverride,flexipage:availableForRecordHome,force:lightningQuickActionWithoutHeader, force:hasRecordId">

    <aura:attribute name="picklistValues" type="Object"/>
    <aura:attribute name="propertyRecord" type="Property__c"/>
    <aura:attribute name="recordError" type="String"/>
    <!--<aura:handler name="init" value="{! this }" action="{! c.doInit }"/>-->

    <force:recordData aura:id="forceRecord"
      layoutType="FULL"
      recordId="{!v.recordId}"
      targetFields="{!v.propertyRecord}"
      targetError="{!v.recordError}"
      mode="EDIT"
      recordUpdated="{!c.recordUpdated}"
      />
    
    <h2><lightning:icon iconName="utility:magicwand" />Amenities</h2><br/>
            <lightning:buttonIcon iconName="utility:travel_and_places" variant="border" alternativeText="Parking" size="medium" />
            <lightning:buttonIcon iconName="utility:wifi" alternativeText="Wifi" size="medium" />
            <lightning:buttonIcon iconName="utility:food_and_drink" alternativeText="Restaurant" size="medium" />
            <lightning:buttonIcon iconName="utility:activity" alternativeText="PlayGround" size="medium" />
            <lightning:buttonIcon iconName="utility:classic_interface" alternativeText="Garden" size="medium" />    
    
    <aura:if isTrue="{!not(empty(v.recordError))}">
        <div class="recordError">
            {!v.recordError}</div>
    </aura:if>
</aura:component>
({
    recordUpdated: function(component, event, helper) {
        var eventParams = event.getParams();
        if(eventParams.changeType === "LOADED") {
           // record is loaded (render other component which needs record data value)
            console.log("Record is loaded successfully.");
        } else if(eventParams.changeType === "CHANGED") {
            // record is changed
        } else if(eventParams.changeType === "REMOVED") {
            // record is deleted
        } else if(eventParams.changeType === "ERROR") {
            // there’s an error while loading, saving, or deleting the record
        }
    }
})