Skip to main content

Notifications

Dynamics 365 general forum

How to create the tabs,sections,fields in the existing form in dynamics 365(On-Premise) using JS

Posted on by Microsoft Employee

I want to create the tab,sections for that tab and add some fields to that tab using Java script for my On-Premise 

Categories:
  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to create the tabs,sections,fields in the existing form in dynamics 365(On-Premise) using JS

    I don't think so you will allow to create dynamics tab,section and fields. Better way to do manually and you can set visibility through JavaScript.

  • gdas Profile Picture
    gdas 50,085 on at
    RE: How to create the tabs,sections,fields in the existing form in dynamics 365(On-Premise) using JS

    Hi ,

    Unfortunately you can not add dynamically tab , section , field in dynamics CRM form . You need to do form design manually and its should be predefined.Above already suggested to do show hide  controls as per your need.

    May I know what exactly your business requirement?

  • Suggested answer
    Kokulan Profile Picture
    Kokulan 18,048 on at
    RE: How to create the tabs,sections,fields in the existing form in dynamics 365(On-Premise) using JS

    Hi

    If I understand your question correctly, you want to dynamically create tabs, sections, and fields using javascript.  In other words, you are trying to do on-the-fly form customization which is normally not recommended and not very straightforward to do.

    Normally this sort of requirement fits into a web resource. In a web resoruce, you can dynamically populate content and do any thing you want.

    I would recommend you re-think about your solution.

    If you definitely have to dynamically display tabs and sections and fields, as LeoAlt suggested, you could add all the tabs and sections and fields and control their visibility using Javascript.

    Show/Hide Tabs

    Xrm.Page.ui.tabs.get("tab1").setVisible(true/false);

    Show/Hide Sections

    Xrm.Page.ui.tabs.get("tabnname").sections.get("sectionname").setVisible(true/false);

    Show/Hide Fields

    Xrm.Page.getControl('field name ').setVisible(true / false);

    If this won't be very useful for your scenario, like I mentioned above, please consider using an HTML web resource and dynamically creating the content.

    https://docs.microsoft.com/en-us/dynamics365/customer-engagement/customize/create-edit-web-resources

  • Suggested answer
    LeoAlt Profile Picture
    LeoAlt 16,329 on at
    RE: How to create the tabs,sections,fields in the existing form in dynamics 365(On-Premise) using JS

    Good day asgvf,

    1. It's a very hard work to add sections or tabs in a form by js because you should get the position where you want to insert your new tab first and then you should use js code to insert the html code of the tab into the form content :-(.

    So if you want to control the visibility of tab/section,  you could use js code to do this easily.

    https://www.c2software.com/c2-blog/using-javascript-library-to-show-or-hide-a-tab-based-on-optionset-value.aspx

    2. We could use js code to call Dynamics 365 webapi to create fields in an entity with the entity's MetadataId .

    https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/webapi/create-update-entity-definitions-using-web-api

    community310.png

    Hope it helps.

    Best Regards,

    Leo

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,104 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans