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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Create a Contact linked to Customer from API

(5) ShareShare
ReportReport
Posted on by 10
Hello,
 
I try to create a Contact (with type Person) record which is related to Customer record.

Tried several ways, but none seem to work (I was able to create Customers and unlinked Contacts). As I understood you do not link that Contact directly to Customer but to another Contact (with Type Company) which is automatically created when Customer is created.

I tried to create a new Contact (with type Person) with a link to Contact that automatically created Contact (with Type Company). I used this body:
 

{

  "displayName": "Test Contact",

  "phoneNumber": "555577777",

  "email": "test@test.com",

  "type": "Person",

  "companyNumber": "CU17414"

}

 


This request gives me such error: You cannot change Company No. because one or more unlogged segments are assigned to the contact.

Any ideas what this error means or how to properly link my new Contact?
I have the same question (0)
  • Suggested answer
    OussamaSabbouh Profile Picture
    12,808 Super User 2026 Season 1 on at
    Hello,
     
    You're using the Customer No. in companyNumber, but the API expects the Company Contact No. (the contact automatically created for the customer).
     
    Fetch it from:
    GET /customers({id})/contactsInformation → use contactNumber from the response → send that in companyNumber.
     
    Regards,
    Oussama Sabbouh
  • Suggested answer
    Gregory Mavrogeorgis Profile Picture
    992 Super User 2026 Season 1 on at
    Hi,
     
    When you create a Customer in Business Central, the system also creates a Contact of type Company in the background.
    But the important thing is:
    That Contact has its own Contact No., which is different from the Customer No.

    So when you tried this:
    you were actually passing the Customer No., not the Company Contact No.
    BC doesn’t allow that, and that’s what causes the “unlogged segments” error. It basically means “you’re trying to use a value in Company No. that I cannot use as a Contact.”
     
    The correct way to do it
    1. First, find the Company Contact that BC created for your customer.
      You can get this by querying:
      • Contacts where type = Company, or
      • Contact Business Relations for your customer.
    That record will have a Contact No. like CT000123.
    1. Use that number in your request:
    After that, BC will happily create the contact and link it under the company.
     
    BC doesn’t let you link a Person Contact directly to a Customer.
    Instead, everything goes through the Company Contact that represents the Customer.
    So your job is simply to find that contact and use its number.

     
    Hi if you find this helpful please marl it as verified
  • Suggested answer
    Jainam M. Kothari Profile Picture
    15,732 Super User 2026 Season 1 on at
    Hello,
     
    You cannot directly set companyNumber when creating a Person-type Contact because Business Central manages company relationships internally.
     
    The correct approach is to first create the Person Contact without linking it, then use the Contact Business Relation to associate it with the Company-type Contact that was automatically created for the Customer.
     
    This error occurs because the system prevents manual changes to Company No. when relationship segments exist, so linking must be done through the proper relationship table or API endpoint rather than in the initial Contact creation request.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,926 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,158 Super User 2026 Season 1

#3
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 533 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans