Skip to main content

Hi All,

 

I am trying to reduce the amount information visible on my pages and what to try and update my alert notification lightning component from showing multiple with different message but 1 alert banner that displays different information based on the Account ID, here is example of my attempt to use IF statement, but clearly not working;

 

<aura:component implements="flexipage:availableForAllPageTypes" access="global" >

 

    <aura:if isTrue="{!v.Account.ID = '0010C00000DbnUSQAZ'}">

    <div class="slds-notify slds-notify_alert slds-theme_alert-texture slds-theme_warning" role="alert">

         

        <lightning:icon iconName="utility:warning" size="small" class="icn"/>

     

        <div class="slds-p-left_medium"></div>

        <strong>

            <div class="slds-text-heading_medium"><p style="font-weight:bold;"> Test1 </p></div>

        </strong>

        <div class="slds-p-right_medium"></div>

        

       <lightning:icon iconName="utility:clock" size="small" class="icn"/>

            

    </div>

    </aura:if>

   

        <aura:if isTrue="{!v.Account.ID = '0010C00000DbnUcQAJ'}">

        <div class="slds-notify slds-notify_alert slds-theme_alert-texture slds-theme_warning" role="alert">

         

        <lightning:icon iconName="utility:warning" size="small" class="icn"/>

     

        <div class="slds-p-left_medium"></div>

        <strong>

            <div class="slds-text-heading_medium"><p style="font-weight:bold;"> Test2 </p></div>

        </strong>

        <div class="slds-p-right_medium"></div>

        

       <lightning:icon iconName="utility:clock" size="small" class="icn"/>

            

    </div>

    </aura:if>

 

</aura:component>

 

What I want is for an alert that has a single purpose that will dynamically change its message based on the Account ID or Name so I add/remove new one to it to display for very specific accounts and reduce the amount of notification that I have to deal with when editing/creating new pages.

 

Thanks

1 comentário
  1. 3 de set. de 2020, 12:35

    You could add a Custom Field to the Account object for Alert Text. Then have your component check to see if that field is not empty and display the alert.

    Another option would be to create a Flow that you add to the Record Page that checks for a value in the Alert field and displays a Toast Message (

    https://unofficialsf.com/show-toast-flow-action/) if needed. #LCAnswers
0/9000