Tip #70 | Get ID from Table

It has been a bit quiet from me for a while. My last blogpost was about two months ago. I’ve not been programming that much and I am evaluating how to move forward with my (freelance) carreer a bit. Don’t take me wrong, I am as busy as I want to be, but that currently means less than 20 hours of working per week and spending much more time on me and my family.

This week I was goofing a bit with archiving data to Cosmos for a project when I needed to have the ID of a table from a variable. This has always been a challenge in Navision. Just Google it and you’ll see.

Since AL leverages more of the fact that our programming language is based on C# I found out, more or less by accident, that this actually works:

    trigger OnOpenPage()
    var
        CompInfo: Record "Company Information";
    begin
        Message(Format(CompInfo.RecordId.TableNo));
    end;

It actually shows this:

How Cool is that!

Leave a Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.