ナレッジベース
公開されました Jun. 30, 2025

Uncaught TypeError: Liferay.Notification is not a constructor

written-by

Sorin Pop

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Issue

  • Adding the below script to any page through any Web content display can reproduce the issue in vanilla.

    <a href="#" onClick="showWltNotification('Your Request failed to process', 'danger');"> Link here </a>
    <aui:script>

        function showWltNotification(message, type) {

            message = message || '<liferay-ui:message key="wlt-your-request-failed-to-complete" />';
            type = type || 'danger';
            AUI().use('liferay-notification', function(){
                new Liferay.Notification({
                    closeable: true,
                    delay: {
                        hide: 5000,
                        show: 0,
                    },
                    duration: 500,
                    message,
                    render: true,
                    title: '',
                    type
                });
            });
        }
    </aui:script>

We are getting the error in the title in the browser console.

 

Environment

  • 2024.q1.2

Resolution

 

 

 

did-this-article-resolve-your-issue

ナレッジベース