Working with companies in API

Companies are in code and database references called contact. Use the context to determine whether contact denotes a real-life company or person. Read more about the SuperOffice view of the world.
company table will make it impossible to sign in for all users. The only fix is to restore the database from backup.Company vs. other entities
The company card uses the contact table and its related tables:

There are multiple person records for any contact. A classic many-to-one relationship.
- A person can only belong to one contact.
- A contact can have zero or more persons.
It is this relationship that drives the first to fields in the follow-up, sale, and document dialogs. Every time you select a new company, the person list below it has to be re-populated.
Person list
To get the list of persons under a contact:
SELECT * FROM person WHERE contact_id = 123 ORDER BY rank
Rows and entities
A ContactRow refers to a row in the contact database table. Therefore, it consists of basic data types supported by SQL.
The Rows type consists of a collection of rows such as ContactRows type consists of a collection of ContactRow types.
The ContactEntity represents a business object. It contains a set of properties bundled up as a single unit representing a particular business object. Entities contain properties of different data types such as properties of basic data types like int, string, boolean, entities, entity arrays, EntityElement, and LocalizedField.
Person property of the ContactEntity is a read-only Person item and not a PersonEntity.Get contact entity
You can get a Contact entity either by using the classes provided in the entities layer or by using the agents in the services layer.
Create contact
Interests

Interests are stored on contacts and persons - there are two separate sets of interests and a separate set of link tables.

The link table (contactinterest) allows a single contact to have zero or more interests checked off.
The ContInt table is an MDO table, so interests can be grouped and organized under headings. The position under a heading does not matter to the linkage to a contact.
SELECT * FROM contint
| ContInt_id | name | rank | tooltip | deleted | registered | registered_associate_id |
|---|---|---|---|---|---|---|
| 854 | Hansa | 136 | Hansa | 0 | 28.10.2021 13.14:59 | 94 |
| 855 | IFS | 137 | IFS | 0 | 28.10.2021 13.18:17 | 94 |
| 856 | Agresso | 133 | Agresso | 0 | 28.10.2021 13.19:23 | 94 |
| 857 | AS400 | 134 | AS400 | 0 | 28.10.2021 13.20:22 | 94 |
SELECT * FROM contactinterest
| contactinterest_id | contact_id | cinterest_idx | startDate | endDate | flags | registered |
|---|---|---|---|---|---|---|
| 53459 | 1 | 594 | 31.12.2021 02:13:49 | 0 | 28.10.2021 13.14:59 | |
| 53640 | 1 | 1569 | 31.12.2021 02:13:49 | 0 | 28.10.2021 13.14:59 | |
| 45770 | 4 | 965 | 31.12.2021 02:13:49 | 0 | 28.10.2021 13.14:59 | |
| 45259 | 9 | 965 | 31.12.2021 02:13:49 | 0 | 28.10.2021 13.14:59 |
You can extend the list of interests for a contact by creating and adding a new interest to that list.
Contact cached value
The contact table has a counter field that stores the number of active interests. This field is used to cache the count. It is updated whenever the user edits the company. The field is used to quickly check whether the interests tab needs to indicate the presence of interests or not.
Interest code examples
Email and URL
To put together a list of the URLs and emails that belong to a contact:
SELECT * FROM url WHERE contact_id = 123 ORDER BY rank
SELECT * FROM email WHERE contact_id = 123 ORDER BY rank
There may be several URLs all referencing the same project_id. This is OK. The URLs will be presented in rank order. The first rank will always be 1.
These are simpler relationships than the owner ID + type relations used on phone and address.
CategoryList
The category list is used to classify a contact. The Contact.Category_id refers to an item on this list.
There are several methods of getting a category list:
Explore the options and select the most appropriate method for your application. Consider using the CategoryCache.
Related content
- Associates
- Contacts - overview (person table)
- Documents - overview
- Follow-ups - overview (appointment table)
- Projects - overview
- Sales - overview
- Address and phone: owner-id and type
- Working with companies in CRMScript
- Working with companies in web NetServer services and REST
- Working with companies at the data layer (entities)
- Working with companies using rows
- Working with companies in Objectified SQL
- Raw SQL queries