web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
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

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

    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

    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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,314 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,781 Super User 2026 Season 1

#3
AndrewThomas81 Profile Picture

AndrewThomas81 1,356

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans