"no component or dynamic content item" error in GrapeJS builder CodeEditor and save

When I try to add a Dynamic Content block from GrapeJS builder to my email and then tried to edit some code and save it. It always shows me an alert error message: “no component or dynamic content item”, when I try to click the save button.

the error can be seen in the image given below. What could be the possible reason for this error ? or is it a bug?

I also tried this with the " Brienz" built-in mautic template. But still getting this issue.

@joeyk I also tried this plugin https://github.com/Logicify/mautic-advanced-templates-bundle
but when I write this code:

{% TWIG_BLOCK %}

Hi {{lead.firstname}},


{% if lead.city == ‘Dresden’ %}

What a great weather is in Dresden this week!


{% endif %}
{% END_TWIG_BLOCK %}

It shows me in editor like this:

and when I send an email It does not show for city ‘Dresden’ this text. What other way could be to use Dynamic Email Content in GrapeJS builder?

Your block is out of the section.

Can you try to include in the column:

<mj-section>
  <mj-column>
    <mj-text>

    {% TWIG_BLOCK %}
    Hi {{lead.firstname}},

    {% if lead.city == ‘Dresden’ %}
    What a great weather is in Dresden this week!

    {% endif %}
    {% END_TWIG_BLOCK %}

    </mj-text>
  </mj-column>
</mj-section>

Thanks @joeyk it is working but we should provide it into the builder editor not directly into the email.

But what about the Dynamic Content block from GrapeJS builder? Is it a bug ? or how I can make it work?

Hello!

It could be a bug. As far as I know, there is no fix for it at the moment, but I could be very wrong.

There are very few people working on the GrapesJS editor right now, and my understanding is, that even if something is fixed, some improvements are not shared back to the community. (I’m not saying it is the case here, but there are a few cases where this happened.)

The reason for that can be various:

  1. There are not enough people testing the PRs fixing an issue. so the coder who fixed it rolls out in his own environment, but never gets merged into Mautic core
  2. The fix only works in Mautic 5, and pushed there. Once M5 is out you can enjoy the feature.
  3. Fixing a bug takes long time, costs money, and it is a market advantage to keep the best version for a Mautic provider on competitive markets. In other words: the fix is not pushed back to the community.

I apologize, but my suggestion is the best workaround I can offer at the momment.

I totally understand the reasons you mentioned @joeyk . Here is the link for new issue which I created in github mautic: https://github.com/mautic/mautic/issues/12481 . Maybe you can mention someone to have a look into this.

Hi, Thank you so much for reporting this bug.
The best I can do is, that I labeled it in github to speed up the process.