Yesterday I had the requirement of making several fields on a Tab Business Required, the Tab contained a lot of fields and I didn’t wanted to hardcode all of them, also I didn’t want to change the Javascript every time a new field is added.

So I googl I mean Binged how to get all the fields from a Tab, and… I couldn’t find it: S

The closest I got was to get the all the fields of Section and from there I just went one level up.



  1. First we get all the controls on the Form.
  2. Navigate through the controls and get the Tab where they are.
  3. In order to do that we need to go 2 levels up, so the trick is control.getParent().getParent().getLabel() //The first getParent takes us to the section and the second one to the Tab.
  4. We compare the name of the Tab with the one we need.
  5. In order to set as Business required a field we can’t use the control, we need the attribute, so we need to get the name of the control first, and then we can set the Required Level.



Thanks to Rhett Clinton (@rhettclinton) for this update 😉

Xrm.Page.ui.tabs.get(tabName).sections.forEach(function (section, sectionIndex) {
section.controls.forEach(function (control, index) {


Hope it helps,