# Implementation example Creation requires an [errands.generalerrandtype](/apis/errands), which defines the kind of errand and which fields are allowed or required. Optionally provide [errands.generalerrandsubtype](/apis/errands) for a more specific type. An errand type (and sub-type) can be restricted to certain object types via `allowed_connection_types`. Some validation depends on the client application. Send the header **`X-PIGELLO-CLIENT-CT`** with value `,mypages,` (e.g. `prod,mypages,1.0.0`) to identify a "My Pages" client. ### Step 1: Read available errand types **If you don't know the object type** the user is creating the errand for, use the first example. **If you do know the object type** (e.g. [objects.apartment](/apis/objects)), use the second example. You can filter by portal using the `allowed_in_portals` parameter (`0`, `1`, `2`, or `3` depending on your client). **Endpoint:** [GET /errands/generalerrands/configurations/generalerrandtype/list/](/apis/errands) **If you don't know the object type:** ``` GET /errands/generalerrands/configurations/generalerrandtype/list/?_page=1&_page_size=500 ``` **Query parameters:** - **_page** — Page number (e.g. 1) - **_page_size** — Page size (e.g. 500) **If you do know the object type (e.g. objects.apartment):** ``` GET /errands/generalerrands/configurations/generalerrandtype/list/?_page=1&_page_size=500&allowed_connection_types__in=objects.apartment ``` **Query parameters:** - **_page** — Page number (e.g. 1) - **_page_size** — Page size (e.g. 500) - **allowed_connection_types__in** — Content type(s) the errand can be bound to (e.g. `objects.apartment`) ### Step 2: Read available errand sub-types **Endpoint:** [GET /errands/generalerrands/configurations/generalerrandsubtype/list/](/apis/errands) ``` GET /errands/generalerrands/configurations/generalerrandsubtype/list/?_page=1&_page_size=500&errand_type__in=, ``` **Query parameters:** - **_page** — Page number (e.g. 1) - **_page_size** — Page size (e.g. 500) - **errand_type__in** — Comma-separated errand type IDs from step 1 ### Step 3: Filter types/sub-types by segment, real estate, company On [errands.generalerrandtype](/apis/errands) and [errands.generalerrandsubtype](/apis/errands), the attributes `segments`, `realestates`, `companies`, and `external_clients` define which entities an errand can be bound to. Only show types and sub-types where these match the object the errand is created for. - If `overrides_object_connection_restrictions` is `true` on a sub-type, the sub-type overrides the errand-type's filters. - Empty filters values on the errand-type/errand-sub-type mean no restriction. - If multiple values or multiple filter types are set, the object need only match one. See [API reference](/apis/errands) for [errands.generalerrandtype](/apis/errands) and [errands.generalerrandsubtype](/apis/errands). ### Step 4: Which fields to show (writeability) Whether an attribute on the general errand is writable or required is configured on the type (and overridden by sub-type when set). Use the **configuration** attributes on the type/sub-type. If a sub-type has a non-null value, it overrides the type. **Configuration** values are arrays of integers (e.g. ORGANIZATION_ALLOW, CUSTOMER_REQUIRE). For a "Customer Pages" client, you need `2` or `3` to allow/require the field. Attributes controlled include `description_configuration`, `object_connection_configuration`, creator/reporter configuration attributes, etc. Also make sure to respect `allowed_in_portals` and `allowed_connection_types`. See [API reference](/apis/errands) for [errands.generalerrandtype](/apis/errands) and [errands.generalerrandsubtype](/apis/errands). ### Step 5: Create the general errand Create the [errands.generalerrand](/apis/errands) first. After that you can attach files and set custom field values. See [API reference](/apis/errands) for [errands.generalerrand](/apis/errands) ### Step 6: File uploads The errand-type (and sub-type) also control whether images, film recordings, or other files can be attached (`images_configuration`, `film_recordings_configuration`, `files_configuration`). Attach files by creating [errands.generalerrandfile](/apis/errands) entities linked to the errand. See [API reference](/apis/errands) for [errands.generalerrandfile](/apis/errands) ### Step 7: Custom fields - Determine which custom fields apply by retrieving [errands.customerrandfieldinclusion](/apis/errands) with filter on `general_errand_type=`. - Retrieve field definition information from [errands.customerrandfieldtype](/apis/errands) with `id__in=,` based on the [errands.customerrandfieldinclusion](/apis/errands). - Retrieve existing custom field values for an errand from [errands.customerrandfieldvalue](/apis/errands). - Submit/update values with [errands.customerrandfieldvalue](/apis/errands). The `required` attribute on [errands.customerrandfieldtype](/apis/errands) defines whether a value is required. See [API reference](/apis/errands) for [errands.customerrandfieldtype](/apis/errands), [errands.customerrandfieldinclusion](/apis/errands) and [errands.customerrandfieldvalue](/apis/errands)