--- title: "Attached document" slug: "doc-attached-document-content-builder" updated: 2026-04-15T06:00:26Z published: 2026-04-15T06:00:26Z canonical: "docs.lobstersoftware.com/doc-attached-document-content-builder" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.lobstersoftware.com/llms.txt > Use this file to discover all available pages before exploring further. # Attached document > [!NOTE] > Value resolver – Abstract > > **Purpose:** Returns the contents of all [Documents](/v1/docs/en/doc-document) assigned to an entity in the *input value* and belonging to the optionally specified [Document type](/v1/docs/en/doc-document-type). > > > [!TIP] > > Tooltip > > > > - **Usage**: The value resolver can be executed with any entity as *input value*. It determines [Documents](/v1/docs/en/doc-document) for which read access exists and which refer to the entity in the input value as the "Referenced object". The **of** **type** parameter can be used to restrict it to one specific [Document type](/v1/docs/en/doc-document-type). The return value is an *array* of data objects of the "Content" type, which is empty if no documents were found. So document entities are not returned, only their content. If the *input value* is not an entity, "No value" (`$null`) is returned. > > - **Parameter**: The static single selection for the **of type** parameter optionally specifies a particular [Document type](/v1/docs/en/doc-document-type) to search for. Without any selection, no restriction is applied to the [Document type](/v1/docs/en/doc-document-type). > > - **NOTE:** The returned document contents are supplied as an *array* and not as a *list*. This array cannot be expanded even if it is explicitly converted to a list. ![images/download/attachments/119253859/image2023-1-25_10-5-10-version-1-modificationdate-1674637510130-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2023-1-25_10-5-10-version-1-modificationdate-1674637510130-api-v2.png) The [Attached document](/v1/docs/en/doc-attached-document-content-builder) value resolver expects an entity as *input value* and returns an *array* listing the "Contents" from the `documentContent` field of all [Documents](/v1/docs/en/doc-document) that meet all of the following criteria: 1. Read access exists for the document in the applicable context. 2. The "Referenced object" (`referencedEntity`) field of the document refers to the type of entity in the *input value*. 3. The "Referenced object ID" (`referencedEntityId`) field of the document refers to the ID (`id`) of the entity in the *input value*. 4. The "Reference status" (`referenceStatus`) field of the document refers to the "Referenced" (`REFERENCED`) status. **NOTE:** Each time a document is saved, the processes described in [Assigning documents](/v1/docs/en/doc-documents-assign) are started again to assign the document. If the assignment fails for a document that has already been successfully assigned, e.g. because another [Document reference type](/v1/docs/en/doc-document-reference-type) is now selected that does not return an entity as a match, then the reference status after saving the document is "Unresolved" (`UNRESOLVED`). This means that the document is not considered "attached" from the point of view of the entity for which criteria 2 and 3 would still be fulfilled. Special case: - If there is no entity as *input value*, the value resolver returns "No value" (`$null`). - If the *input value* is an entity, but no [Documents](/v1/docs/en/doc-document) are found that meet the above criteria, an empty *array* is returned. - If the i*nput value* is an entity and exactly one document meets the above criteria, its content is returned as the only entry in an *array*. **NOTE:** The value resolver is not used to access [Documents](/v1/docs/en/doc-document) as entities, but only returns their content. Access to the data of the document entities for "Attached documents", on the other hand, would be provided, for example, by a [Search (Event action)](/v1/docs/en/core-search-actor) for the "Document" (`en.lobster.scm.doc.Document`) entity type, which must map the above criteria (2, 3 and 4) with reference to the *input value*. > [!NOTE] > **CAUTION****:** The return value is an array and NOT a list. > > --- > > The fact that the return value is an *array* and not a real "List" (`List`) may occasionally cause restrictions or require precautions. The following list does not claim to be complete: > > - An *array* does not pass a [Check type](/v1/docs/en/core-check-type-rule) for the "List" (`List`) type. The combination of the "Is collection of" option in connection with the "Content" type in the [Check type](/v1/docs/en/core-check-type-rule) does not solve this problem. > - Access to existing entries in the *array* via the [List item](/v1/docs/en/core-list-item-resolver) value resolver is possible (in contrast to previous versions of **Lobster Data Platform/Orchestration**). > - However, no entries can be added to the *array*. > - With the [Input object (type safe)](/v1/docs/en/core-root-entity-resolver) value resolver, the *array* can be formally converted into a list which then also withstands type checking. > - However, no entries can be added to this list either. ## Configuration The *input value* is expected to be an entity of any type, since [Documents](/v1/docs/en/doc-document) can only be assigned to entities, i.e. "Attached" to them. | The optional **of type** parameter can be used to limit the selection of [Documents](/v1/docs/en/doc-document) to exactly one specific [Document type](/v1/docs/en/doc-document-type) by static single selection. Without a selection for the **of type** parameter, the value resolver returns the contents of all assigned documents (criteria see above) regardless of their [Document type](/v1/docs/en/doc-document-type). The selection is supported by a search function which, as shown in the image, takes into account not only the localization but also the internal name for the [Document type](/v1/docs/en/doc-document-type). If [Enumeration filters](/v1/docs/en/core-dynamic-enum-filter) are applicable to the [Document type](/v1/docs/en/doc-document-type) in the context of the configuration, they restrict the selection. However, [Enumeration filters](/v1/docs/en/core-dynamic-enum-filter) do not change the runtime behavior of a configuration. | ![images/download/attachments/119253859/image2023-1-25_10-6-13-version-1-modificationdate-1674637573160-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2023-1-25_10-6-13-version-1-modificationdate-1674637573160-api-v2.png) | | --- | --- | ## Example ### Simple use case: "Resume" file(s) attached to the user An association criterion (see [Association criteria](/v1/docs/en/core-association-criteria)) is considered passed if the *input value* in the data context is a [Users](/v1/docs/en/base-user) for whose account at least one "Attached" document of the [Document type](/v1/docs/en/doc-document-type) "Curriculum Vitae" (`CV`) is found. Configuration: | The association criteria combines two rules in an AND [Junction](/v1/docs/en/core-rule-junction): - In the input, a [Check type](/v1/docs/en/core-check-type-rule) ensures that [Users](/v1/docs/en/base-user) are present in the context. - If this is the case, an [Entity property rule](/v1/docs/en/core-entity-property-rule) should use the negated [Is empty](/v1/docs/en/core-is-empty-matcher) compare type to determine whether (at least) one resume document is found for the [Users](/v1/docs/en/base-user) in the *input value*: - The [Attached document](/v1/docs/en/doc-attached-document-content-builder) value resolver searches for documents **of type** "Curriculum Vitae" type and, if successful, returns a list of "Content" objects with the `documentContent` of the found [Documents](/v1/docs/en/doc-document). - The concatenated [Store value as variable](/v1/docs/en/core-store-value-resolver) value resolver stores the result list in the `docCV` variable. If the present association criteria is used e.g. in the context of an event handling as a [Sub criterion rule](/v1/docs/en/core-association-sub-criteria-rule), the attached "Curriculum Vitae" contents can be accessed via this variable. | ![images/download/attachments/119253859/image2023-1-25_10-8-40-version-1-modificationdate-1674637720430-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2023-1-25_10-8-40-version-1-modificationdate-1674637720430-api-v2.png) | | --- | --- | Runtime example: *Value of the variable* `docCV` if *exactly* one attached PDF document with the [Document type](/v1/docs/en/doc-document-type) "Curriculum Vitae" (`CV`) was found for the user: ```xml                                   JVBERi0xLjUNCiW1tbW1DQoxID[...]                     ``` - The return value is an `array` object with an `item` of the "Content" (`Content`) type. - The "Content" object represented by the `item` element contains the `base64` file content in the `body` element as well as the "Media type" (`mediaType`) and "Name" (`name`) as XML attributes. ### More complex use case: Compile file attachments for a shipment A [Custom action event](/v1/docs/en/core-custom-action-events) event triggers a notification by e-mail in the context of a workflow for a business object of the "shipment" ([Shipments](/v1/docs/en/shp-shipment)) type. The following files should be attached to generated [E-mails](/v1/docs/en/administration-system-mail): - The contents of all assigned [Documents](/v1/docs/en/doc-document) for the program in question. - A PDF file deposited on the **Lobster Data Platform/Orchestration** server containing the current terms and conditions. The *body* of the mail should list the names of the attached documents. Therefore, all attachments are collected in an `attachments` list variable before the [E-mail](/v1/docs/en/core-send-mail-actor) event action is executed. Configuration: | The screenshot on the right shows an excerpt from an event handler that controls the assignment to the `attachments` list variable via [Set value](/v1/docs/en/core-set-value-actor) event action: On the right side of the assignment, the list of all relevant attachments is compiled by a value resolver chain: - The first entry in the [Create list](/v1/docs/en/core-create-list-resolver) value resolver retrieves the contents of all [Documents](/v1/docs/en/doc-document) assigned to the shipment in the *input value*: - Here the [Attached document](/v1/docs/en/doc-attached-document-content-builder) value resolver is used without any selection for **of type** parameter, so that it provides the contents of *all* [Documents](/v1/docs/en/doc-document) as an *array* without regard to the [Document type](/v1/docs/en/doc-document-type). - The concatenated [Input object (type safe)](/v1/docs/en/core-root-entity-resolver) value resolver converts the *array* into a list (`List`), which is necessary here because the **Join** **collections** option in the concatenated [Collect values](/v1/docs/en/core-collect-resolver) value resolver below does not automatically treat the *array* like a real list." **NOTE:** The **Type "**Content" is explicitly assigned here only for the purpose of transparency in the configuration. A type conversion on the level of entries is neither necessary here nor would it be represented in this form (see [Input object (type safe)](/v1/docs/en/core-root-entity-resolver)). - The second entry in the [Create list](/v1/docs/en/core-create-list-resolver) value resolver obtains the "General Terms and Conditions" via the [File reference](/v1/docs/en/core-file-reference-content-builder) value resolver using a statically defined relative path (`./upload/AGB.pdf`). This value resolver returns the "Content" (`Content`) of the file stored there at runtime. - The concatenated [Collect values](/v1/docs/en/core-collect-resolver) value resolver below converts the "nested" list structure created above into a flat list of "Content" objects by setting the **Join collections** option and configuring the **Value to collect** via [Object property](/v1/docs/en/core-property-resolver) value resolver without selecting a field. **IMPORTANT:** It would be counterproductive here to use an [Input object (type safe)](/v1/docs/en/core-root-entity-resolver) value resolver with the "Content" (`Content`) type for the **Value to collect** instead of the [Object property](/v1/docs/en/core-property-resolver) value resolver, since the **Join collections** is only applied after the **Value to collect**. | ![images/download/attachments/119253859/image2023-1-25_10-10-25-version-1-modificationdate-1674637825566-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2023-1-25_10-10-25-version-1-modificationdate-1674637825566-api-v2.png) | | --- | --- |