Microsoft Dynamics Embedded Code Not Working After First Attempt in Modal

104 views Asked by At

I’m using embedded code from Microsoft Dynamics in a modal. The first time I open it, it works correctly. However, on subsequent attempts (second, third, etc.), it stops working. Could someone explain why this happens and how I can fix it?

<div class="modal-personalizado">
    <div class="modal-content-personalizado">
        <div class="modal-personalizado-header">
            <span class="modal-title-personalizado fRegular">@RGlobal.SuscripcionNewsletters</span>
        </div>
        <div class="modal-personalizado-body">
            <div id="formContainer" data-form-id='My_Key'
                 data-form-api-url='https://public-sam.mkt.dynamics.com/api/v1.0/orgs/4dc021bb-8922-ee11-a66b-00224837a3ef/landingpageforms'
                 data-cached-form-url='https://assets-sam.mkt.dynamics.com/4dc021bb-8922-ee11-a66b-00224837a3ef/digitalassets/forms/My_Key'>
            </div>
        </div>
        <div class="modal-footer-personalizado">
            <button type="button" class="boton-cerrar fMedium" onclick="AbrirModalPersonalizado()">@RModalEmail.btnCerrar</button>
        </div>
    </div>
</div>

<script src="https://cxppusa1formui01cdnsa01-endpoint.azureedge.net/sam/FormLoader/FormLoader.bundle.js"></script>

I opened the modal, closed it, opened it again and expected the Dynamics form to appear, but it didn’t load at all. I tried to load the script dynamically in the document.ready and it also didn’t work.

1

There are 1 answers

0
Ale Ladner On BEST ANSWER

Well, I was able to achieve it after almost a day and a half: IT WAS AS EASY AS PUTTING

d365mkt = undefined; 

WHEN I CLOSE THE MODAL

The truth is that it is a shame that a Microsoft product and PAID has these shitty problems.

That on top of that, the solution is not even in the official documentation, but you have to be guessing and playing with the code.

I hope that if anyone has an error like the one I had, it will save them hours of headaches.