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...
Answered

Create Customer with AL Code

(0) ShareShare
ReportReport
Posted on by 55

Hi, 
I am trying to create a client via code in a Sandbox environment.
Here is the code I am using :

CustomerRec.Init;
        SalesReceivablesSetup.GET();

        CustomerRec."No." := NoSeriesMgt.GetNextNo(SalesReceivablesSetup."Customer Nos.", WorkDate(), true);

        CustomerRec.Name := 'XXX';
        CustomerRec."Gen. Bus. Posting Group" := format('BINNENLAND');

        if CustomerRec.Insert() then begin
            exit(true)
        end else begin
            Message('Une erreur est survenue lors de la création du client!');
            exit(false);
        end;


When inserting, I get the following error: "Gen. Bus.  Posting Group" empty

pastedimage1667577731899v1.png

pastedimage1667577842202v2.png

Do you have any idea where the error could come from?

Thanks

I have the same question (0)
  • Verified answer
    Maxence Profile Picture
    55 on at

    Sorry, I noticed that my object was not the right one.

    If I pass the right object, the insert is done correctly

  • Andy Sather Profile Picture
    on at

    Thank you for replying back to your post.

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,316

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 2,449 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,431 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans