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

Announcements

News and Announcements icon
Community site session details

Community site session details

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

Get table field base type

(1) ShareShare
ReportReport
Posted on by
 
       public boolean getBaseType()
        {
            boolean ret;
            DictField               dictField;
            FieldName                 tableFieldName = this.field1;
            TableName               tableNameFromRef = this.field2;
            DictTable               dictTable = new SysDictTable(tableName2Id(tableNameFromRef));
            while (tableFieldName)
            {
                dictField = dictTable.fieldObject(tableFieldName);
                myTable.FieldType = dictField.baseType();
            }
            return ret;
        }
 
I have the same question (0)
  • Suggested answer
    Layan Jwei Profile Picture
    8,284 Super User 2026 Season 2 on at
    Hi User,

    I think your code in the while loop is erroring right? you don't need a while loop.

    Maybe try something like this and please update us if it works
      
    public boolean modified()
    {
        boolean ret;

        ret = super();

        if(ret)
        {
            TableId      tableId1  = tableName2Id(Grid_Tables.valueStr());
            FieldName    fieldName = Grid_FieldName.valueStr();
            FieldId      fieldId   = fieldName2Id(tableId1, tableFieldName);

            DictField  dictField = new DictField(tableId1, fieldId);

            TableX_ds.object(fieldNum(TableX, FieldType)).setValue(strFmt("%1",dictField.baseType()));
        }

        return ret;
    }


    Thanks,
    Layan Jweihan
    Please mark the answer as "Verified" if it solved your question. In order to help others as well
  • Verified answer
    Martin Dráb Profile Picture
    240,538 Most Valuable Professional on at
    Note that the better place for your logic is modifiedField() method on the table, not modified() method of an individual form control. It's better for reusability and discoverablity.
     
    There you code may look like this:
    public void modifiedField(FieldId _fieldId)
    {
        switch (_fieldId)
        {
            case fieldNum(MyTable, MyFieldId):
                if (this.TableName && this.FieldName)
                {
                    this.FieldType = SysDictField::newName(this.TableName, this.FieldName).baseType();
                }
                else
                {
                    this.FieldType = Types::void;
                }
                break;
        }
    }

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

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

#1
Martin Dráb Profile Picture

Martin Dráb 345 Most Valuable Professional

#2
CU10121822-0 Profile Picture

CU10121822-0 304

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 283 Super User 2026 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans