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

Adding contact to 'company' contact via API

(1) ShareShare
ReportReport
Posted on by 35
Hello,
 
We create customers (company type) via the standard API interface.
I am trying to add a contact for that customer also by API.
It seems I can only do that if I specify the company number (although looks like a contact no.) of the previously auto created contact. ie. "companyNumber = CT000076" in the contact create code.
 
My issue is how do I retrieve that CT number so I can create a new contact? Its not exposed by the customer endpoint and the contacts API cannot be searched by customer number or ID.
 
 
I have the same question (0)
  • Suggested answer
    YUN ZHU Profile Picture
    95,763 Super User 2025 Season 2 on at
    Hi, If this field is not included in the standard API, it needs to be customized.
    Dynamics 365 Business Central: Can we extend standard APIs? – Download Standard Source Code for APIs
     
    In addition, regarding automatically created contacts, you can actually set the system to not create them automatically.
    Dynamics 365 Business Central: Automatically create contacts when creating customers/vendors/bank accounts
     
    Hope this helps.
    Thanks.
    ZHU
  • Verified answer
    Gerardo Rentería García Profile Picture
    25,390 Most Valuable Professional on at
    Hi
    What our colleague Yun indicated is correct, if you want to customize or add functionality to an API you must customize it. Here I leave you some other interesting links, in addition to the link where you find the code for the standard APIs.
    Best
    GR
  • Verified answer
    IH-07071528-0 Profile Picture
    35 on at
    Hello.
    Thanks for all your help. Now all sorted.
    For future searchers:
     
    1) Create a custom API to expose Contact Business Relation Table (5054).
    2) After creating a new customer. (Contact is auto created in our setup) use that API to return the 'Contact No' field where the 'No.' field is the customer number of the just created  customer. There will only be one as only just created customer.
    3) Create a new contact (type person) and fill the 'No.' field with the just returned value above.
    Not fully tested or error trapped yet but the basic method seems to work.
     
    Loving this software, incredibly well thought out and structured.
     
     
     

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 2,116

#2
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 764 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 635 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans