Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested answer

Is there a way to get all field names from a table?

(0) ShareShare
ReportReport
Posted on by 70

Hi All,

I'm working in AL and the only way I've seen to get field names is using the Record.Field() method, which requires field name as a parameter...

I tried to create a loop that went from 0 to field count and retrieved field(Index), however the field numbers often skip and can sometimes go upwards of 1000, which would take an extremely long time if I tried to iterate the index that high. Are there any other ways I could loop through a table and get each field?

  • Vlad_K Profile Picture
    10 on at
    RE: Is there a way to get all field names from a table?

    Hi,

    Best option is to use Field Virtual Table as suggested by MahGah. No RecRefs, no loops, just a table with complete list of fields with IDs and Names and many other.

    BR,

    -Vladimir

  • Connor Hyde Profile Picture
    70 on at
    RE: Is there a way to get all field names from a table?

    I think I've got something working. Similar to what I have above, but instead you can use RecRef.FieldIndex(Iterator), which returns the index of the fields, regardless of the actual assigned field number.

  • Connor Hyde Profile Picture
    70 on at
    RE: Is there a way to get all field names from a table?

    Hi NorthW,

    Thanks for the response, would you be able to elaborate any more on how I could manipulate these variables to get what I need? I've been messing around with them and I'll post the closest thing I have to getting them all. It would work, however since the field numbers don't increment by one I think this would take way too long. The last field on table "Item" has a number of 99008500.

    *Edit I forgot to include that FieldNum starts at 0

    GetFields.PNG

  • Suggested answer
    MahGah Profile Picture
    15,443 on at
    RE: Is there a way to get all field names from a table?

    Hi

    see this article 

    https://docs.microsoft.com/en-us/dynamics-nav/field-virtual-table

    if you are in BC SaaS then try  https://businesscentral.dynamics.com/?table=2000000041 

    or see https://yzhums.com/1055/ 

  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,025 Moderator on at
    RE: Is there a way to get all field names from a table?

    If you want to do it programmatically you must look into using field ref and record ref variables.

    docs.microsoft.com/.../recordref-data-type

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
YUN ZHU Profile Picture

YUN ZHU 374 Super User 2025 Season 1

#2
Mansi Soni Profile Picture

Mansi Soni 247

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 231 Most Valuable Professional

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans