Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

Dynamically add HTML form control

(0) ShareShare
ReportReport
Posted on by 2

I want to add a "HTML Viewer" control dynamically through X++. This is because I want to add a new control per each attached document I have against an invoice.

My issue is that the "HTML Viewer" control does not have a type defined in the FormControlType enum. It looks like the FormControlType for the "HTML Viewer" gets dynamically created on runtime and I cannot pass it in the "addControl" method. I debugged and it says the "HTMLViewer" is of type "45" and if we check the "FormControlType" enum, it only goes up to 44.

This is what I tried and it did not work because of the form control type (I tried with different control types such as HTML, None, etc but nothing works)

pastedimage1598873154766v2.png

Instead, I also tried using the "FormHTMLControl" but it looks like its deprecated, I do the same logic, instead of the parmHtml I use the setText() method but the form just shows empty. Here is the code I tried with the "FormHTMLControl":

pastedimage1598873215943v3.png

Does anyone knows I can get a workaround for this?

Thank you

  • Suggested answer
    Michal Krejza Profile Picture
    on at
    RE: Dynamically add HTML form control

    Hello Joao,

    Have you checked following page: stackoverflow.com/.../use-css-in-d365-fo-html-viewer

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,079 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,860 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans