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...
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
    101,846 Super User 2026 Season 1 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
    27,054 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

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,454 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,806 Super User 2026 Season 1

#3
AndrewThomas81 Profile Picture

AndrewThomas81 1,538

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans