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
Anonymous DeveloperAnonymous Developer 

Question regarding Custom Component Notification

Good Day to all,

Is it possible for a custom component notification created in the community to receive the same notifications as the custom notification inside your org, if so please explain to me how it works?

 
Suraj Tripathi 47Suraj Tripathi 47
Hi,

Here is the custom notification component:
Component :

<aura:component description="NotificationToast_cmp" access="global">
    <aura:attribute name="variant" type="String" default="success" access="global" description="gives the variant to the toast" />
    <aura:attribute name="message" type="String" default="Record Saved Successfully!" access="global" description="gives the message to the toast" />
    <aura:attribute name="duration" type="Integer" default="3000" access="global" description="gives the time duration to the toast" />
    <aura:attribute name="showToast" type="Boolean" default="false" access="global" description="to show or hide the toast" />
    <aura:handler name="change" action="{!c.changeToastHandler}" value="{!v.showToast}" />
    <aura:handler name="init" action="{!c.changeToastHandler}" value="{!this}" />

    <!--Toast Start-->
    <aura:if isTrue="{!v.showToast}" >
        <div aura:id="toast" class="slds-backdrop slds-backdrop--open" style="z-index: 10000;">
            <div class="slds-p-top_small" style="height: 4rem;">
                <div class="slds-notify_container slds-is-relative">
                    <div class="{!v.variant == 'success' ? 'slds-notify slds-notify_toast slds-theme_success':'slds-notify slds-notify_toast slds-theme_error'}" role="alert">
                        <span class="slds-assistive-text">{!v.variant}</span>
                        <span class="slds-icon_container slds-icon-utility-success slds-m-right_small slds-no-flex slds-align-top" >
                        <lightning:icon alternativeText="toast" iconName="{!v.variant == 'success'? 'utility:success' : 'utility:error'}" size="small" class="fillclr"/>
                    </span>
                        <div class="slds-notify__content">
                            <h2 class="slds-text-heading_small ">{!v.message}</h2>
                        </div>
                        <button class="slds-button slds-button_icon slds-notify__close slds-button_icon-inverse" title="Close" onclick="{!c.closeToast}" >
                            <lightning:icon alternativeText="Close" iconName="utility:close" size="small" class="fillclr"/>
                            <span class="slds-assistive-text">Close</span>
                        </button>
                    </div>
                </div>
            </div>
        </div>
    </aura:if>
</aura:component>


Controller:

({
    closeToast : function(c, e, h) {
        c.set("v.showToast", false);
    },

    changeToastHandler : function (c, e, h) {
        if (c.get('v.showToast') === true) {
            window.setTimeout(
                $A.getCallback(function () {
                    c.set("v.showToast", false);
                }), c.get('v.duration')
            );
        }
    }
})
 Thanks.

 
Anonymous DeveloperAnonymous Developer
Hello, @Suraj Tripathi 47 Thank you for the answer but it's not the answer that I was looking for. 
All it does is get me a confirmation mechanism when I as a user take action, but it does not give me the notification this is the result but the notification is blank.

User-added image
What I really need is for my custom component notification which is the RED one to receive the same confirmation message as the custom notification one which is the GREEN one.

User-added image

Thanks for taking the time to answer my question. Much appreciated.