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
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
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.
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
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,
* 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
André Arnaud de Cal...
292,111
Super User 2025 Season 1
Martin Dráb
230,934
Most Valuable Professional
nmaenpaa
101,156