I'm trying to use the addComplexSuccessMessage function on admin custom module, but I get an empty message.

The code I have is the following:


    <!-- Admin HTML Complex Messages -->
    <type name="Magento\Framework\View\Element\Message\MessageConfigurationsPool">
            <argument name="configurationsMap" xsi:type="array">
                <item name="createDocumentSuccessMessage" xsi:type="array">
                    <item name="renderer" xsi:type="const">\Magento\Framework\View\Element\Message\Renderer\BlockRenderer::CODE</item>
                    <item name="data" xsi:type="array">
                        <item name="template" xsi:type="string">Invoicing_Moloni::messages/createDocumentSuccessMessage.phtml</item>


// @codingStandardsIgnoreFile
/** @var \Magento\Framework\View\Element\Template $block */

<?= $block->escapeHtml(__(
    'Document was sucessefuly created: <a href="%1">Open document</a>.',


                'document_url' => $this->_url->getUrl('document/url')

I can't seem to understand why I get this empty message: enter image description here

If anyone could help, I would really appreciate


Found a couple things I was doing wrong. First, the messages folder must be inside the adminhtml/templates; Second, I was editing the etc/di.xml while I should be adding that code to etc/adminhtml/di.xml

For all that have some problems with complexMessages, I'll leave this post :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.