web
You’re offline. This is a read only version of the page.
close
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?

I have the same question (0)
  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,105 Moderator on at

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

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

  • Suggested answer
    MahGah Profile Picture
    15,529 on at

    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/ 

  • Connor Hyde Profile Picture
    70 on at

    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

  • Connor Hyde Profile Picture
    70 on at

    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.

  • Vlad_K Profile Picture
    10 on at

    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

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,229

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,867 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,153 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans