# Contact Persons _(Realtime-enabled)_

`GET` `POST` `PATCH` `DELETE` _(Table: Contact)_

```
eOne/core/v1.0/contactPersons
```

Writable API for **person** contacts (not company contacts). The company a person belongs to can be set directly or resolved from the related customer/vendor.

## Link to a company

Set `companyNumber` directly, or resolve the parent company from a customer/vendor with `customerIntegrationId` or `vendorIntegrationId`. See [Resolver fields](https://eonesolutions.github.io/eone-bc-integration/resolvers.md).

> **Note:** If that customer/vendor has no company contact yet, the API **creates one for you**, the company contact plus its business relation, then attaches the person to it. This requires the business relation code to be set in Marketing Setup ("Bus. Rel. Code for Customers/Vendors"); without it the create is rejected with a clear error.

> **Caution:** PATCHing `number` **renames** the contact rather than creating a new one.

## Bound actions

Invoke with `POST /contactPersons(<id>)/Microsoft.NAV.<action>`:

- `setAsPrimaryContact`: marks this person as the **primary contact** on its company's customer and/or vendor. Optional body `{ "linkToTable": "Customer" }` (or `"Vendor"`) narrows the target; omit it (or send blank) to apply to every business relation the company contact carries. The response redirects back to the contact.

> **Note:** "Primary contact" is a single-valued pointer on the parent record (`Customer`/`Vendor` "Primary Contact No."), not a flag on the contact. So the action has the same effect as PATCHing `primaryContactNo` on the [customers](https://eonesolutions.github.io/eone-bc-integration/core-customers.md) / [vendors](https://eonesolutions.github.io/eone-bc-integration/core-vendors.md) endpoint, in one hop from the contact. The person must already be linked to a company (`companyNumber`), and that company must have a customer or vendor business relation.

## Contact Persons fields

_API column → BC field._

**Legend**

- _(req)_ required on create
- _(res)_ resolver
- _(cur)_ currency-translated
- _(ro)_ read-only
- _(ext)_ added to this endpoint by another extension (BC field name shown; its API column name is not known here)

| API | BC field | Notes |
| --- | --- | --- |
| `id` | SystemId | BC record GUID. _(ro)_ |
| `bcCompanyId` | bcCompanyId | The company this row belongs to - the same GUID that appears in the request URL. Present on every endpoint so a store pooling several companies can keep them apart without relying on which URL it called. _(ro)_ |
| `bcCompanyName` | bcCompanyName | The name of the company this row belongs to. _(ro)_ |
| `number` | No. | Primary key. PATCH renames. |
| `integrationId` | EONE Integration Id | Your external key. |
| `displayName` | Name | Contact name. _(req)_ |
| `searchName` | Search Name |  |
| `type` | Type | Person (this API is persons only). _(ro)_ |
| `companyNumber` | Company No. | Parent company contact. |
| `companyName` | Company Name | _(ro)_ |
| `customerNumber` | customerNumber | Resolve company from a customer. |
| `customerId` | customerId | Resolve company from a customer GUID. _(ro)_ |
| `customerIntegrationId` | customerIntegrationId | Resolve company from a customer key. _(res)_ |
| `vendorNumber` | vendorNumber | Resolve company from a vendor. |
| `vendorId` | vendorId | Resolve company from a vendor GUID. _(ro)_ |
| `vendorIntegrationId` | vendorIntegrationId | Resolve company from a vendor key. _(res)_ |
| `firstName` | First Name |  |
| `middleName` | Middle Name |  |
| `surname` | Surname |  |
| `jobTitle` | Job Title |  |
| `addressLine1` | Address |  |
| `addressLine2` | Address 2 |  |
| `city` | City |  |
| `county` | County |  |
| `countryRegionCode` | Country/Region Code |  |
| `postalCode` | Post Code |  |
| `phoneNumber` | Phone No. |  |
| `mobilePhoneNumber` | Mobile Phone No. |  |
| `email` | E-Mail |  |
| `email2` | E-Mail 2 |  |
| `website` | Home Page |  |
| `languageCode` | Language Code |  |
| `salespersonCode` | Salesperson Code |  |
| `vatRegistrationNumber` | VAT Registration No. |  |
| `registrationNumber` | Registration Number |  |
| `privacyBlocked` | Privacy Blocked |  |
| `createdDateTime` | SystemCreatedAt | _(ro)_ |
| `lastModifiedDateTime` | SystemModifiedAt | _(ro)_ |
