# Process

A process is the link between entities in fulfillmenttools. Each order, pick job, handover job, and so on, references a process, and each process maintains the IDs of its entities. Furthermore, the process includes the statuses of the domains, modules, and entities.

{% hint style="warning" %}
The expression domain for the fields in the process class is not correct. Correct is module instead of domain. This will be fixed in the future.
{% endhint %}

Some fields of the process class:

```json
{
    "id": "111-222-333",
    // ...
    "pickJobRefs": [],
    "handoverJobRefs": [],
    // ...
    "status": "CREATED",
    "domsStatus": "CREATED",
    "returnStatus": "NOT_AVAILABLE",
    "operativeStatus": "CREATED",
    "domainStatuses": [
        "PICKING": "CREATED",
        // ...
    ],
    "lastDomainEntityStatuses": [
        {
            "domain": "PICKJOB",
            "status": "CREATED",
            "entityId": "123456789"
        },
        // ...
    ]
    // ...
}
```

## Process statuses calculation flow

The different status of the process are calculated depending on their predecessors. The start status is the `lastDomainEntityStatuses` (at the left of the image), with this the `domainStatuses` are calculated. `domsStatus` and `operativeStatus` are calculated from the `domainStatuses`. The final overall `status` based on `domsStatus` and `operativeStatus`.

<figure><img src="/files/JJvW4qdQOP4ObrdEPWDq" alt=""><figcaption></figcaption></figure>

## Description of different status

fulfillmenttools contains different pillars[^1] and modules. Every pillar has multiple modules, and every module includes entities like a `pickJob` in the `PICKING` module or a `routingPlan` in the `ROUTING` module.

For the different Process-Status-Calculation, only the `DOMS` and `LOCAL OPERATIONS` modules are taken into account.

<figure><img src="/files/5t7jB59TYJ5Xl0jn6Mrb" alt=""><figcaption></figcaption></figure>

### `lastDomainEntityStatuses`

Contains only the last status of every entity. An entity (for example, `routingPlan`, `pickJob` or `handoverJob`) status change in a module (for example, `PACKING` or `ORDER`), will update the entry of the corresponding entity in this list.

Example JSON:

```json
"lastDomainEntityStatuses": [
    {
        "domain": "ROUTING_PLAN",
        "status": "FINISHED",
        "entityId": "ROUTING-A-0000-1111"
    }, {
        "domain": "ROUTING_PLAN",
        "status": "FINISHED",
        "entityId": "ROUTING-B-0000-1111"
    }, {
        "domain": "PICKJOB",
        "status": "CREATED",
        "entityId": "PICK-A-2222-3333"
    },
    // ...
]
```

Because the noticed status in `lastDomainEntityStatuses` must work with all entities from different modules, these saved status are not the original status that's defined in the module. The original status is mapped into one, which can be used across all modules.

### `domainStatuses`

Contains module clean statuses that will be calculated from the module entities from the `lastDomainEntityStatuses`. For example, we have one status for `PICKING` or `SHIPPING`.

Example JSON:

```json
"domainStatuses": [
    "ORDER": "FINISHED",
    "ROUTING_PLAN": "FINISHED",
    "PICKING": "CREATED",
    // ...
]
```

The status enum type is the same like in `lastDomainEntityStatuses`, `DomainStatus` and can be found in our [REST API documentation](https://fulfillmenttools.github.io/fulfillmenttools-api-reference-ui/#get-/api/processes/-processId-).

### `domsStatus`, `operativeStatus`, and `inventoryStatus`

Each of these three statuses contains a clear domain status. For the calculation of these three statuses, the associated module statuses from the `domainStatuses` list are taken.

### `status`

This is the overall `status`, and it will be calculated with the three status `domsStatus`, `operativeStatus` and `inventoryStatus`.

### `returnStatus`

This status tracks the progress of returns associated with this order. As long as no returns are in progress, this status will be `NOT_AVAILABLE`. Contrary to other process status like `domsStatus` or `operativeStatus`, the `returnStatus` doesn't influence the overall status of the process. This is because an order is counted as complete once all its items are shipped. If a return is issued later on, the progress should not be reopened. The process will remain `CLOSED`, only its returns will be `IN_PROGRESS`.

[^1]: There are 5 pillars that make up fulfillmenttools. This was previously known as a domain, so this naming can still be found in the API.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.fulfillmenttools.com/documentation/getting-started/process.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
