web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

Using JavaScript in MarketingForm - Current Status?

(0) ShareShare
ReportReport
Posted on by 147

Dear All,

is there any update on the usage of JavaScript in an embedded MarketingForm?

I did not found any official documentation regarding this possibility, however the scripts in the form are not executed on the external website.

Thank you and best regards,

Philipp

I have the same question (0)
  • Verified answer
    cloflyMao Profile Picture
    25,210 on at

    Hi Philipp,

    What the usage of JavaScript in an embedded MarketingForm do you want?

    Do you mean embbed javascript not works on your own website? or do you want some API for embbed marketing form?

    ---------------------------------------------------------------------------------------------------------------------------------------------

    > If you want some API for embbed marketing form, there are 2 types API for add customization:

    1. Personalized page content.

    https://docs.microsoft.com/en-us/dynamics365/marketing/personalized-page-content

    You can display personalized content for different people with window.msdyncrm_personalizedpage function.(run it on same same)

    e.g: if address1_country equals a specific country.

    Prerequisites:

    * prefilling option has been checked for both marketing form level and input fields level

    * user has checked "remember me" checkbox in form

    * domain which hosts the form has been authenticated(whitelist the website only works for non-prefilling form)

    2. Perform custom action based on form event.

    https://docs.microsoft.com/en-us/dynamics365/marketing/developer/marketing-form-client-side-extensibility

    e.g: afterFormLoad or formSubmit.

    You can also get some information such as form page id with this.

    Prerequisite:

    * Just whitelist the external website is ok.

    My demo page will display form information after the form is loaded.

    https://maoalex.best/custom/welcome.html

    pastedimage1583992446016v1.png

    All of embedded form script is in first card div element, you could copy my page source code and replace my embbed form with yours for test.

    ---------------------------------------------------------------------------------------------------------------------------------------------

    > If embbed javascript not works, please do

    >> if form can't display

    * check whether you CMS has blocked custom javascipt.

    * open browser console to check whether there is any error log.

    * check whether form element has been hidden by CSS rule if you can find form element has been actually created by inspector,

    1882.PNG

    * check whether you domain has been actually authenticated.

    e.g if you host form on www.xxx.com,(subdomain) then you should also authenticate www.xxx.com instead of xxx.com(root domain).

    >> if form can be rendered but you can't submit data

    * the possible reason is that you had set the form type to subscripition center, this type of form should be opened via link in marketing email to work.

    Regards,

    Clofly

  • Philipp Focust Profile Picture
    147 on at

    Hello Clofly,

    thank you very much for the detailed update regarding this issue.

    It is very useful however I wanted to know if it's possible to use JS directly in the HTML part of the form designer.

    However you already gave me the answer that it's currently not supported.

    The usage of the form events will do it as well.

    Thank you and best regards,

    Philipp

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

News and Announcements

Season of Giving Solutions is Here!

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Pallavi Phade Profile Picture

Pallavi Phade 98

#2
Tom_Gioielli Profile Picture

Tom_Gioielli 79 Super User 2025 Season 2

#3
TAHER Mehdi Profile Picture

TAHER Mehdi 58

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans