> ## Documentation Index
> Fetch the complete documentation index at: https://docs.superoffice.com/llms.txt
> Use this file to discover all available pages before exploring further.

# document table

> Documents, this table is an extension of the Appointment table.  There is always a corresponding appointment record; the relation between appointment and document is navigable in both directions. A document-type appointment record always has a corresponding document record and a record in VisibleFor specifying who may see this.

## document Table (10)

Documents, this table is an extension of the Appointment table.  There is always a corresponding appointment record; the relation between appointment and document is navigable in both directions. A document-type appointment record always has a corresponding document record and a record in VisibleFor specifying who may see this.

## Fields

| Name                      | Description                                                                                                    | Type                                | Nullable |
| ------------------------- | -------------------------------------------------------------------------------------------------------------- | ----------------------------------- | :------: |
| document\_id              | Primary key                                                                                                    | PK                                  |    No    |
| application\_id           | Application this document was made with                                                                        | FK [ExtApp](./extapp.mdx)           |    No    |
| name                      | File name                                                                                                      | String(511)                         |    No    |
| header                    | Visible document name                                                                                          | String(219)                         |    Yes   |
| our\_ref                  | Our reference, searchable field from freetext search                                                           | String(99)                          |    Yes   |
| your\_ref                 | Your reference                                                                                                 | String(99)                          |    Yes   |
| searchname                | Searchable name (not used?)                                                                                    | String(99)                          |    Yes   |
| attention                 | Attention/salutation                                                                                           | String(99)                          |    Yes   |
| text\_id                  | Pointer to optional long description                                                                           | FK [text](./text.mdx)               |    Yes   |
| archiveProvider           | Document plugin id copied from the DocTmpl.autoevent\_id - tells us where the document content is stored       | Id                                  |    Yes   |
| appointment\_id           | points back to owning appointment                                                                              | FK [appointment](./appointment.mdx) |    Yes   |
| registered                | Registered when                                                                                                | UtcDateTime                         |    No    |
| registered\_associate\_id | Registered by whom                                                                                             | FK [associate](./associate.mdx)     |    No    |
| updated                   | Last updated when                                                                                              | UtcDateTime                         |    No    |
| updated\_associate\_id    | Last updated by whom                                                                                           | FK [associate](./associate.mdx)     |    No    |
| updatedCount              | Number of updates made to this record                                                                          | UShort                              |    No    |
| extref                    | External reference (notes ID, email ID, URL, whatever) for use by document plugin in locating document content | String(511)                         |    Yes   |
| userdef\_id               | User-defined fields                                                                                            | FK [uddocsmall](./uddocsmall.mdx)   |    Yes   |
| userdef2\_id              | User-defined fields                                                                                            | FK [uddoclarge](./uddoclarge.mdx)   |    Yes   |
| snum                      | The sequence number allocated from refcount on used template when creating the document                        | Int                                 |    Yes   |
| ExtUrl                    | For DocPlugin-internal use only. Used to optionally cache URL of external documents.                           | String(1023)                        |    Yes   |
| contentSetCount           | Number of times content has been set on this document.                                                         | Int                                 |    No    |

<img src="https://mintcdn.com/superofficeas/i6M2qZmvMNH7UTeu/media/loc/en/database/tables/document.png?fit=max&auto=format&n=i6M2qZmvMNH7UTeu&q=85&s=c68e16df5aee6193755d0461705a79dd" alt="document table relationship diagram" width="937" height="817" data-path="media/loc/en/database/tables/document.png" />

## Indexes

| Fields          | Types       | Description |
| --------------- | ----------- | ----------- |
| header          | String(219) | Index       |
| our\_ref        | String(99)  | Index       |
| searchname      | String(99)  | Index       |
| archiveProvider | Id          | Index       |
| extref          | String(511) | Index       |
| userdef\_id     | FK          | Index       |
| userdef2\_id    | FK          | Index       |

## Relationships

| Table                                                | Description                                                                                                                                                                 |
| ---------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [appointment](./appointment)                         | Tasks, appointments, followups, phone calls; and documents (document\_id != 0). An appointment always has a corresponding record in VisibleFor specifying who may see this. |
| [associate](./associate)                             | Employees, resources and other users - except for External persons                                                                                                          |
| [email\_item](./email-item)                          | Email data                                                                                                                                                                  |
| [ExtApp](./extapp)                                   | ExtApp list table. Applications startable from SuperOffice                                                                                                                  |
| [Quote](./quote)                                     | Quote root level, at most one per Sale, always connected to one Sale                                                                                                        |
| [QuoteVersionAttachment](./quoteversionattachment)   | Actual attachments to a quote                                                                                                                                               |
| [s\_message](./s-message)                            | A message used in a shipment. Can be html and/or plain text                                                                                                                 |
| [s\_shipment](./s-shipment)                          | Contains info about one shipment. The addresses are stored in s\_shipment\_addr                                                                                             |
| [SaleTypeQuoteAttachment](./saletypequoteattachment) | Default attachments to quotes linked to sales of this type                                                                                                                  |
| [text](./text)                                       | Long text fields from all over the system                                                                                                                                   |
| [uddoclarge](./uddoclarge)                           | User-defined fields                                                                                                                                                         |
| [uddocsmall](./uddocsmall)                           | User-defined fields                                                                                                                                                         |

## Replication Flags

* Area Management controlled table. Contents replicated to satellites and traveller databases.
* Replicate changes UP from satellites and travellers back to central.
* Copy to satellite and travel prototypes.
* Cache table during filtering.

## Security Flags

* Sentry controls access to items in this table using user's Role and data rights matrix on the table's parent.


## Related topics

- [Document table](/en/api/bulk-operations/bulk-update/reference/document-table.md)
- [doc_document table](/en/database/tables/doc-document.md)
- [external_document table](/en/database/tables/external-document.md)
- [SuggestedDocument table](/en/database/tables/suggesteddocument.md)
- [uddoclarge table](/en/database/tables/uddoclarge.md)
- [uddocsmall table](/en/database/tables/uddocsmall.md)
