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

I have the same question (0)
  • 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.

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

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

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

#1
Sumit Singh Profile Picture

Sumit Singh 2,085

#2
YUN ZHU Profile Picture

YUN ZHU 1,810 Super User 2025 Season 2

#3
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 1,788

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans