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

1 Answer 1


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 :)

  • 1
    I am still getting the plain text of anchor tag in addComplexSuccessMessage. I have followed the same way provided by you. I am using Magento 2.3.4. Commented Mar 20, 2020 at 7:15
  • Don't be like me and forget to run setup:di:compile after you change di.xml...
    – Imanuel
    Commented Dec 28, 2020 at 14:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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