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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Adding dynamic field controls in the form

(1) ShareShare
ReportReport
Posted on by 302
Hello All,
 
I am trying to add dynamic controls in the form. I have added a tabPage, a group and added field controls in the group.
 
The form is working fine, but the tab page is collapsed while opening the form. I tried to use tabPage.FastTabExpanded(FastTabExpanded::Always), the tab is expanded but the controls are not visible. If I set tabPage.FastTabExpanded(FastTabExpanded::Yes) fields are visible but tabpage is collapsed and have to extend them manually.
 
Adding the code for reference,
 
private FormGroupControl buildTabPageControl(){    FormGroupControl            groupControl;    FormTabPageControl          tabPageControl;    tabPageControl = callerTabControl.addControl(FormControlType::TabPage, 'TestTabPage' + enum2Str(FormControlType::TabPage),        callerInsertAfterControl ? callerInsertAfterControl : callerTabControl.controlNum(callerTabControl.controlCount()));    tabPageControl.caption('Test'');    if (callerTabControl.style() == TabStyle::FastTabs)    {        tabPageControl.fastTabExpanded(FastTabExpanded::Always);    }    groupControl = tabPageControl.addControl(FormControlType::Group, 'TestGroup'' + /@SYS80404/);    groupControl.arrangeMethod(FormArrangeMethod::HorizontalWrap);    return groupControl;}
 
Any insights or suggestions on what I might be missing or causing this behavior?
I have the same question (0)
  • Layan Jwei Profile Picture
    8,165 Super User 2026 Season 1 on at
    Hi WeKey,
     
    Can you please share ur code again in the comments section, because it's not readable.
     
    Are you saying in case u set it as always, none of the fields appear? Did u try to clear usage data?
     
    Here's more info about the fastTab expanded property
     
  • André Arnaud de Calavon Profile Picture
    303,485 Super User 2026 Season 1 on at
    Hi Wekey,
     
    When I quickly scan your coding, I don't see fields being added. Can you share the full method in a new reply, please?
  • Wekey Profile Picture
    302 on at
    Hello Andre and Layan,
     
    Thanks for the reply. I tried to add the code snippet I am not sure why the code looks that way. However adding the remaining code here
    private FormGroupControl getFormGroupControl()
    {
        FormGroupControl groupControl;
    
        groupControl = this.buildTabPageControl();        
    
        return groupControl;
    }
    
    void updateDesign(boolean _isDynamicControl = false)
    {
        Map                 fieldsAdded;
        FormGroupControl    formGroupControl;        
    
        formGroupControl    = this.getFormGroupControl();
        fieldsAdded         = this.getAvailableField();
    
        if (_isDynamicControl)
        {
            this.addDynamicFieldsControl(formGroupControl, fieldsAdded);
        }
        else
        {
            
            this.addFieldsControl(formGroupControl, fieldsAdded);
        }
    }
    private void addDynamicFieldsControl(FormGroupControl _formGroupControl, Map _fieldsAdded)
    {
        MapEnumerator   fieldsEnumerator = _fieldsAdded.getEnumerator();
    
        _formGroupControl.columns(_fieldsAdded.elements() ? _fieldsAdded.elements() : 1);
    
        while (fieldsEnumerator.moveNext())
        {
            str fieldType = Table::getFieldType(fieldsEnumerator.currentKey());
    
            switch (fieldType)
            {
                case enum2Str(FieldType::String):
                    FormStringControl stringControl = _formGroupControl.addControl(FormControlType::String, fieldId2Name(tableNum(Table), fieldsEnumerator.currentKey()));
                    stringControl.label(fieldsEnumerator.currentValue());
                    stringControl.text(formDataSource.cursor().(fieldsEnumerator.currentKey()));
                    stringControl.lookupButton(Table::exist(fieldsEnumerator.currentValue()) ? FormLookupButton::Always : FormLookupButton::Never);
                    stringControl.registerOverrideMethod(methodStr(FormStringControl, lookup), methodStr(TestFormHelper, dynamicCtrlLookup), this);
                    stringControl.registerOverrideMethod(methodStr(FormStringControl, modified), methodStr(TestFormHelper, dynamicCtrlModified), this);
                    stringControl.cacheDataMethod(NoYes::Yes);
                    break;
    
                case enum2Str(FieldType::Integer):
                    FormIntControl intControl = _formGroupControl.addControl(FormControlType::Integer, fieldId2Name(tableNum(Table), fieldsEnumerator.currentKey()));
                    intControl.label(fieldsEnumerator.currentValue());
                    intControl.value(formDataSource.cursor().(fieldsEnumerator.currentKey()));
                    break;
    
                case enum2Str(FieldType::Real):
                    FormRealControl realControl = _formGroupControl.addControl(FormControlType::Real, fieldId2Name(tableNum(Table), fieldsEnumerator.currentKey()));
                    realControl.label(fieldsEnumerator.currentValue());
                    realControl.realValue(formDataSource.cursor().(fieldsEnumerator.currentKey()));
                    break;
    
                case enum2Str(FieldType::Date):
                    FormDateControl dateControl = _formGroupControl.addControl(FormControlType::Date, fieldId2Name(tableNum(Table), fieldsEnumerator.currentKey()));
                    dateControl.label(fieldsEnumerator.currentValue());
                    dateControl.dateValue(formDataSource.cursor().(fieldsEnumerator.currentKey()));
                    break;
    
                case enum2Str(FieldType::DateTime):
                    FormDateTimeControl dateTimeControl = _formGroupControl.addControl(FormControlType::DateTime, fieldId2Name(tableNum(Table), fieldsEnumerator.currentKey()));
                    dateTimeControl.label(fieldsEnumerator.currentValue());
                    dateTimeControl.dateTimeValue(formDataSource.cursor().(fieldsEnumerator.currentKey()));
                    break;
    
                case enum2Str(FieldType::Checkbox):
                    FormComboBoxControl comboBoxControl = _formGroupControl.addControl(FormControlType::ComboBox, fieldId2Name(tableNum(Table), fieldsEnumerator.currentKey()));
                    comboBoxControl.label(fieldsEnumerator.currentValue());
                    comboBoxControl.enumType(enumNum(TestEnum));
                    comboBoxControl.selection(formDataSource.cursor().(fieldsEnumerator.currentKey()));
                    break;
    
                default:
                    //do nothing
                    break;
            }
        }
    }
    private FormGroupControl buildTabPageControl()
    {   
        FormGroupControl            groupControl;
        FormTabPageControl          tabPageControl;
    
        tabPageControl = callerTabControl.addControl(FormControlType::TabPage, 'Test' + enum2Str(FormControlType::TabPage),
            callerInsertAfterControl ? callerInsertAfterControl : callerTabControl.controlNum(callerTabControl.controlCount()));
        tabPageControl.caption("TestTabPage");
    
        groupControl = tabPageControl.addControl(FormControlType::Group, 'Test' + "@SYS80404");
        groupControl.arrangeMethod(FormArrangeMethod::HorizontalWrap);
    
        return groupControl;
    }
     
  • Wekey Profile Picture
    302 on at
    Original code as it was not readable in the post
    private FormGroupControl buildTabPageControl()
    {   
        FormGroupControl            groupControl;
        FormTabPageControl          tabPageControl;
    
        tabPageControl = callerTabControl.addControl(FormControlType::TabPage, 'Test' + enum2Str(FormControlType::TabPage),
            callerInsertAfterControl ? callerInsertAfterControl : callerTabControl.controlNum(callerTabControl.controlCount()));
        tabPageControl.caption("Test TabPage");
    
        if (callerTabControl.style() == TabStyle::FastTabs)
        {
      	tabPageControl.fastTabExpanded(FastTabExpanded::Always);
        }
        groupControl = tabPageControl.addControl(FormControlType::Group, 'Test' + "@SYS80404");
        groupControl.arrangeMethod(FormArrangeMethod::HorizontalWrap);
    
        return groupControl;
    }
    Also I tried to get the tabPageControl and do the same tabPageControl.fastTabExpanded(FastTabExpanded::Always); after adding the fields to the group, still no luck with that it behaves the same. If I set the FastTabExpanded::Yes (Anything expect Always)  I can able to see the field but the tabpage is collapsed. When I set to Always the tabPage is expanded but couldn't able to see the fields.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 518 Super User 2026 Season 1

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 431

#3
Adis Profile Picture

Adis 280 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans