Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 general forum
Suggested answer

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,083 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,327 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

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 288,420 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,672 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans