Skip to content
Using OpenAI to write AL code for Business Central

Writing code with a text-based AI for Business Central

Daniel Gorski
Daniel Gorski 03. Dezember 2022
2 Min. Lesezeit

What/Who is OpenAI?

OpenAI was founded in 2015 by a group of leading researchers and tech industry figures, including Elon Musk and Sam Altman. The organization's mission is to develop and promote friendly AI that will benefit humanity as a whole. To achieve this goal, OpenAI conducts cutting-edge research in areas such as machine learning, natural language processing, and computer vision.

https://openai.com/

How does it work?

Login or register on openai.com and start a new thread:

ChatGPT's empty starting screen showing example prompts, capabilities, and limitations before any question has been asked

Ask anything you want:

ChatGPT response explaining what Microsoft Dynamics 365 Business Central is, after being asked

Nice :)!

So lets go for the next one:

ChatGPT confirming it understands AL code after being asked

Pretty cool! And what about some specific requirements?

ChatGPT outlining the fields for a

And now AL code:

ChatGPT generating the actual AL code for the Gift Card table in a syntax-highlighted code block, after being asked to write the table and page in AL

Wow, not bad or? Ok you need to adjust some properties but overall it's pretty cool:

table 50100 "Gift Card"
{
    DataClassification = CustomerContent;
    fields
    {
        field(1; "Gift Card ID"; Code[20])
        {
            DataClassification = CustomerContent;
        }
        field(2; "Card Number"; Code[20])
        {
            DataClassification = CustomerContent;
        }
        field(3; "Expiration Date"; Date)
        {
            DataClassification = CustomerContent;
        }
        field(4; "Card Value"; Decimal)
        {
            DataClassification = CustomerContent;
        }
        field(5; "Customer ID"; Code[20])
        {
            DataClassification = CustomerContent;
        }
    }
    keys
    {
        key(PK; "Gift Card ID")
        {
            Clustered = true;
        }
    }
}

page 50100 "Gift Card Details"
{
    layout
    {
        area(Content)
        {
            group("Card Information")
            {
                field("Card Number"; "Card Number")
                {
                }
                field("Expiration Date"; "Expiration Date")
                {
                }
                field("Card Value"; "Card Value")
                {
                }
                field("Customer"; "Customer ID")
                {
                }
            }
        }
    }
}

Animated recap of the ChatGPT conversation, replaying the empty landing page through the prompts and AL code responses shown above

Related posts

how-to
tools & ai
business central
al development
openai
ai tools
productivity
EN
E-Invoicing formats UBL, CII, ZUGFeRD and Factur-X compared

E-Invoicing

July 21, 2026 - Daniel Gorski

UBL, CII, ZUGFeRD, Factur-X: E-Invoicing Formats Finally Explained

UBL, CII, ZUGFeRD or Factur-X – these e-invoicing formats get confused all the time. We break down the difference between pure XML formats and hybrid…

Read More
Read More: UBL, CII, ZUGFeRD, Factur-X: E-Invoicing Formats Finally Explained
DE
GoBD-konforme Archivierung mit Business Central und SharePoint ohne DMS

Architektur

April 24, 2026 - Sven Wischhusen

Revisionssicher archivieren ohne DMS? Wie weit Business Central, SharePoint und Azure Blob Storage wirklich tragen

Warum „GoBD" oft vorschnell zum K.O.-Kriterium wird – und wie weit Business Central, SharePoint und Azure Blob Storage wirklich tragen.

Read More
Read More: Revisionssicher archivieren ohne DMS? Wie weit Business Central, SharePoint und Azure Blob Storage wirklich tragen