Hi Carlos,
Due to same-origin security policy of browser, the iframe page hosting the marketing form must be in the same path as its parent page, only then can we access the document and functions in the iframe.
For example, if index page is located in /var/www/CMS, then the iframe page is needed to be located in any sub folder of /var/www/CMS.(Like /var/www/CMS/pages)
When the prerequisite is met, we can use iframe.contentWindow to get document of iframe, and iframe.contentWindow.xxx to access xxx function in iframe.
Please notice that functions in iframe can be only accessed after iframe page is loaded, otherwise the function will be undefined.
// Get iframe element
var iframe = document.getElementsByTagName("iframe")[0];
// Wait for iframe document being loaded
iframe.addEventListener('load', function () {
// Access function in iframe
var MsCrmMkt = iframe.contentWindow.MsCrmMkt;
// Get document of iframe
var iframeDocument = iframe.contentWindow.document;
MsCrmMkt.MsCrmFormLoader.on('afterFormLoad', function (event) {
var firstnameField = iframeDocument.getElementById("3f746946-34b4-442c-a677-e232cdd2bc40");
firstnameField.value = "Clofly";
})
})
The code above will populate first name field of iframe-hosted marketing form.

Regards,
Clofly