> For the complete documentation index, see [llms.txt](https://en.help.firstline.cc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://en.help.firstline.cc/developer/api/custom-field.md).

# Custom fields

Given different industries or different business logics, data requirements will inevitably vary. Fixed form formats on the market are hard to meet everyone's needs, so FIRST LINE lets users create the data they need through custom fields.

## Custom type

Custom fields are divided into four uses, applied respectively to "Customer" and "Work Order" data relationships

| Code | Name                                                         | Description                                                                                                                                                    |
| ---- | ------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 0    | <p><strong>Customer</strong><br><strong>form</strong></p>    | Additional fields added to the original form, for example the customer's weight, blood type, etc. This kind of field belongs to**form fields.**                |
| 1    | <p><strong>Customer</strong><br><strong>table</strong></p>   | Adding a one-to-many relation from the original form, for example multiple purchase records of a customer, belongs to**related tables.**                       |
| 2    | <p><strong>Work Order</strong><br><strong>form</strong></p>  | Additional fields added to the original form, for example the work order's batch number, processing status, etc. This kind of field belongs to**form fields**. |
| 3    | <p><strong>Work Order</strong><br><strong>table</strong></p> | Adding a one-to-many relation from the original form, for example multiple shipping records of a work order, belongs to**related tables**.                     |

## Field type

Custom fields currently have the following types; each code represents a different storage type

| Code | Field type      |
| ---- | --------------- |
| 0    | Number field    |
| 1    | Text field      |
| 2    | Boolean         |
| 3    | Date            |
| 4    | Time            |
| 5    | Date and time   |
| 6    | Single choice   |
| 7    | Multiple choice |

Options parameter is available for 6 (single choice) and 7 (multiple choice). The options for this field are recorded in JSON format. Below is an example using blood types:

```javascript
[
    { "text":"Type A",  "value": "A"},
    { "text":"Type B",  "value": "B"},
    { "text":"Type AB", "value": "AB"},
    { "text":"Type O",  "value": "O"}
]
```

An extra field added to the original form, for example `Customer` of `weight`, this kind of field belongs to **dynamic form fields**

Adding a "one-to-many" relation to the original form, for example `Customer` of `purchase records`, belongs to **dynamic related tables**

## Query system custom fields

Custom fields currently in the system

```javascript
GET https://{API_DOMAIN}/api/v1/cz-col
```

```javascript
curl -X GET
    -H "Content-Type: application/json:Authorization: Bearer eyJhbGciOiJIUzI1NiI..." https://{API_HOST}/api/v1/cz-col
```

### Parameters

| PARAMETER    | REQUIRED | DEFAULT | TYPE   | DESCRIPTION                                                                                                                            |
| ------------ | -------- | ------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------- |
| page         | false    | 1       | Number | Which page is currently on                                                                                                             |
| per\_page    | false    | 15      | Number | How many items to display per page                                                                                                     |
| category\_id | false    | NULL    | Number | [Dynamic field category](https://help.firstline.cc/developer/api/hui-ying-wu-jian-ge-shi#dong-tai-lan-wei-fen-lei-czcolcategory) id of |
| types        | false    | NULL    | Number | 0: Customer dynamic form field 1: Customer dynamic related table 2: Work order dynamic form field 3: Work order dynamic related table  |

### Response

| PROPERTY | TYPE             | DESCRIPTION                                                                     |
| -------- | ---------------- | ------------------------------------------------------------------------------- |
| data     | Array of objects | [Dynamic field array](/developer/api/response-object.md#dong-tai-lan-wei-czcol) |
| meta     | Object           | Pagination meta                                                                 |

```javascript
{
    "data": [
        {
            "id": 1,
            "name": "Cyril223",
            "description": "Assumenda est corrupti voluptas aut. Beatae quisquam ex asperiores sit ullam.",
            "is_allowed_null": true,
            "default": null,
            "type": 4,
            "category_id": null,
            "category": null,
            "creater_id": null,
            "creater": null
        }
    ],
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 10,
        "per_page": 1,
        "to": 1,
        "total": 10
    }
}
```
