Skip to main content
Community site session details

Community site session details

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

Problem with inserting Customer Bank Account through custom API

(0) ShareShare
ReportReport
Posted on by 30

Hi, so the primary key of the CBA is  ( Customer No. + Code ) . But we handle the Code field internally to make sure the field is consistent.If i try to POST an insert through my API which only contains Customer No. and IBAN , I get the error "Code must have a value in Customer Bank Account .It cannot be zero or empty. Which i understand but that's been taking care of in the OnBeforeInsert() trigger which is never reached.

( P.S.: Is there something equal to "Breakpoints on Trigger" in Navision? I don't know want to set the earliest breakpoint possible on an "attach and debug next" session.)

  • matthias_rabus Profile Picture
    160 on at
    RE: Problem with inserting Customer Bank Account through custom API

    I think Daniel is correct how to do it.

    As long as the table prevents empty values in the Code field, you either have to set the Code field to some 'dummy' value or use an intermediate table to do the inserts.

    The BC API v2 is using this construct to insert Sales Quote lines and sales order lines.

  • Daniel Rimmelzwaan Profile Picture
    3,485 on at
    RE: Problem with inserting Customer Bank Account through custom API

    When you set a value in an API page, it validates the field value. The Code field in the Customer Bank Account table does not allow blank values. You'll get an error from the field validation when you send in a record with no value in the Code field. You could try mapping the field to a variable and catching the OnInsertRecord trigger and take care of the field value there. The standard CBA table does not have any OnInsert logic to automatically populate the Code field by the way.

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

Ramesh Kumar – Community Spotlight

We are honored to recognize Ramesh Kumar as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

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

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 2,655

#2
Mansi Soni Profile Picture

Mansi Soni 1,574

#3
YUN ZHU Profile Picture

YUN ZHU 1,453 Super User 2025 Season 1

Featured topics

Product updates

Dynamics 365 release plans