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...
Suggested Answer

How to create a new entity and link to another entity in a single request via API?

(0) ShareShare
ReportReport
Posted on by 15

Hi,

Sorry for submitting another question. I can't seem to reply to the other. I receive an error in both Chrome and Edge.

Further to previous enquiries, I have found a similar issue when creating a new entity that has a key that is effectively a foreign key to another entity type.

I have Vendors and Vendor Bank Accounts. The Vendor Bank Account has an ID and Vendor Number as keys. The Vendor Number determines the relationship between the two entities.

When I do a POST to create a Vendor Bank Account I provide the ID and Vendor Number in the body...

.../OData/Company('XXX')/Vendor_Bank_Account_Card

{

"Vendor Number": "10",

"ID": "1"

}

(Also tried "Vendor_Number")

However I receive a message...

The Vendor Bank Account already exists. Identification fields and values: Vendor Number='',ID='1'

The request doesn't seem to recognise the Vendor Number value.

Any assistance would be greatly appreciated as the issue is driving me crazy.

I have the same question (0)
  • Lars Lohndorf-Larsen Profile Picture
    on at

    Hello,

    Thank you for asking. I have not seen the other post you mention, so apologies if I send you info you already know, but I think you are looking for "deep insert", for example like shown here www.kauffmann.nl/.../ .

    If the linked record is blank, I think it may have to do with the page design, and a link property there, more than the API call itself. I don't know if this helps you?

  • Suggested answer
    YUN ZHU Profile Picture
    95,329 Super User 2025 Season 2 on at

    Hi, the primary key of table Vendor Bank Account (288) is Code and Vendor No..

    It looks like you are publishing standard Vendor Bank Account Card (425) page into a WebService. When entering Code on this page, the Vendor Number is automatically Validated. But when you use Post externally, the code executed may not be correct. So I suggest you don't use the standard page, create a new Vendor Bank Account page, and then publish it to the Web Service

    pastedimage1643935448511v1.png

    Hope this will help.

    Thanks.

    ZHU

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

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,694 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,067 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans