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

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

Can you add javascript directly to a Marketing form without having to create a landing page?

(0) ShareShare
ReportReport
Posted on by 183

Hi,

I know how to extend forms using javascript but so far it only looks like it works by adding the script to a landing page you create instead of directly to the marketing form itself in the HTML portion of the editor. Is this still not supported?

I have the same question (0)
  • Community Member Profile Picture
    on at

    Hi pdr469,

    Please refer to the following documentation to know more about how to extended marketing form using JavaScript.

    Extend marketing forms using code (Dynamics 365 Marketing Developer Guide) | Microsoft Docs

  • pdr469 Profile Picture
    183 on at

    I’m aware of the article but the article doesn’t specify if you can directly modify the form itself with JavaScript. Does anyone know if that’s supported?

  • Community Member Profile Picture
    on at

    Hi pdr469,

    Add JavaScript code on your Marketing form and test this custom code using marketing pages.

    Add validations using JavaScript to Marketing form in Dynamics 365 | by Pooja Bhardwaj | Medium

  • pdr469 Profile Picture
    183 on at

    That still sounds like you have to add the script to a page later and not to the form itself. I’m looking for a supported way to add the code directly to the form within the form designer HTML.

  • Verified answer
    Petr Jantac Profile Picture
    Moderator on at

    The javascript inside the HTML code of the form is supported. But there are some limitations, like certain events are triggered before the form markup is injected into a page, those won’t be available for the script added within a form.

    Thank you.

    Petr

  • immilev Profile Picture
    on at

    No, you can't.  In Dynamics marketing forms are of 3 types, one of them being Landing Page. Technically, you can't have a marketing form without a page for it.

  • Suggested answer
    Stefano Sala Profile Picture
    15 on at

    Hi Phil,

    I regularly use some Js code to add functionality to the Dynamics 365 marketing module. For example, I use it to give dynamicity or to create conditions for visibility of certain fields.

    As @Petr Jantač rightly pointed out, however, this definitely has limitations. To understand this, one must consider that the marketing module, and thus its code, is loaded in a specific order within the web page (creating a D365 marketing page or embedding the module in one's own web pages).

    In any case, you can test your customizations in real-time with tools such as Visual Studio Code or other tools that allow you to have a graphical preview online.

    Happy coding!

    Regards,

    Stephen

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

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
Tom_Gioielli Profile Picture

Tom_Gioielli 81 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 49 Most Valuable Professional

#3
#ManoVerse Profile Picture

#ManoVerse 40

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans