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...
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)
  • Verified answer
    IH-07071528-0 Profile Picture
    35 on at
    Adding contact to 'company' contact via API
    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.
     
     
     
  • Verified answer
    Gerardo Rentería García Profile Picture
    22,524 Most Valuable Professional on at
    Adding contact to 'company' contact via API
    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
  • Suggested answer
    YUN ZHU Profile Picture
    89,830 Super User 2025 Season 2 on at
    Adding contact to 'company' contact via API
    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

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…

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

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

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 2,899 Super User 2025 Season 2

#2
Sumit Singh Profile Picture

Sumit Singh 2,444

#3
Jeffrey Bulanadi Profile Picture

Jeffrey Bulanadi 2,304

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans