Understanding loneliness

By admin , 9 January 2024
Raw Html #36020000 ✎ Edit
<script src='https://cxppusa1formui01cdnsa01-endpoint.azureedge.net/oce/FormCapture/FormCapture.bundle.js'></script>
<script>
  // NOTE: for reference see https://go.microsoft.com/fwlink/?linkid=2250770

  d365mktformcapture.waitForElement("form[action*='TestIntegrationForm']")
  .then(form => {
    // Filter only visible input fields (text and email)
    const inputs = Array.from(form.querySelectorAll("input")).filter(input =>
      ["text", "email"].includes(input.type)
    );

    const mappings = [
      {
        FormFieldName: inputs[0].name,
        DataverseFieldName: "firstname"
      },
      {
        FormFieldName: inputs[1].name,
        DataverseFieldName: "lastname"
      },
      {
        FormFieldName: inputs[2].name,
        DataverseFieldName: "emailaddress1"
      }
    ];

    form.addEventListener("submit", (e) => {
      const serializedForm = d365mktformcapture.serializeForm(form, mappings);

      // Inject default value for hidden Business Domain field
      serializedForm.SerializedForm.DefaultValues = [
        {
          DataverseFieldName: "custom_businessdomain", // Replace with actual schema name
          DataverseValue: "100000004" // Other
        }
      ];

      const payload = serializedForm.SerializedForm.build();

      const captureConfig = {
        FormId: "e80182e4-245e-f011-bec2-00224896a6a8",
        FormApiUrl: "https://public-oce.mkt.dynamics.com/api/v1.0/orgs/3d5e3a68-613e-4bcd-b429-e41fe43af731/landingpageforms"
      };

      d365mktformcapture.submitForm(captureConfig, payload);
    }, true);
  });
</script>
Raw Html #36020001 ✎ Edit
<div data-tf-live="01KCQCFQ6PMXWNDGCA26K6BCKJ"></div><script src="//embed.typeform.com/next/embed.js"></script>