--- title: "Generate barcodes" slug: "cmn-generate-barcodes-actor" updated: 2026-04-02T06:23:04Z published: 2026-04-02T06:23:04Z canonical: "docs.lobstersoftware.com/cmn-generate-barcodes-actor" --- > ## 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. # Generate barcodes *See also:* [Generate barcodes (Order)](/v1/docs/en/ord-generate-barcodes-actor), [Generate barcodes (Shipment)](/v1/docs/en/shp-generate-barcodes-actor) > [!NOTE] > Event action – Abstract > > **Purpose:** Fills barcode attributes of line items of a general business object with values from a number range. Optionally, the number of barcode attributes within a line item is synchronized with the 'Number of packages' of the same line item by adding or removing barcode attributes, if necessary > > > [!TIP] > > Tooltip > > > > - **Usage:** The event action must be executed with a general business object as the *reference* *object*. The **Line** **items** and **Line item types** parameters define *relevant* *line* *items* in the *reference* *object*. For these, the number of barcode attributes contained is regulated depending on the **Sync** **barcodes** **with number of packages** option. As far as a number range is assigned for the selected [Number range type](/v1/docs/en/core-number-range-type), barcode attributes without a barcode value are filled from this number range. > > - **Parameter:** > > - The required selection for the **Number range type** defines which of the configured [Number range](/v1/docs/en/core-number-range) barcodes are to be obtained in order to fill barcode attributes without a barcode value. > > - If the **Sync barcodes with number of packages** option is selected, barcode attribute instances are added or removed, if necessary, so that the number of barcodes in a line item corresponds to the 'Number of packages'. > > - Two parameters are available for defining the *relevant line items* within the *reference* *object*, which can be used alternatively: > > - The **Line** **items** parameter can be used to define an explicit list of line items by value explorer. > > - The multiple selection for **Line item types** allows a general selection of line items by [Line item type](/v1/docs/en/base-line-item-type). > > - If none of the parameters are used, all line items with the [Line item type](/v1/docs/en/base-line-item-type) 'Default' (`DEFAULT`) are considered relevant. > > - **Output:** In relevant line items, barcode attributes without a barcode value are assigned a barcode from a number range. Optionally, 'missing' barcode attributes are added or 'surplus' ones are removed. ![images/download/attachments/78255453/image2021-8-20_21-36-35-version-1-modificationdate-1629488199610-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2021-8-20_21-36-35-version-1-modificationdate-1629488199610-api-v2.png) > [!NOTE] > Barcode attributes background > > At the item level of business transaction objects, the 'Barcode attribute' can be assigned as a *multiple attribute*, if necessary, several attribute instances with the fields 'Barcode' (`barcode`) and 'Barcode reference' (`barcodeReference`). The same item can therefore have multiple barcode values. > > **CAUTION****:** There must be no duplicates for the value in the 'Barcode' field within the barcode attribute instances for a given line item, otherwise saving the transaction object will fail with an error. > > This is true even if for several barcode_attribute_instances of the same item the 'Barcode' field is empty. > > The [Generate barcodes](/v1/docs/en/cmn-generate-barcodes-actor) event action can be used to maintain barcode uniqueness by populating each empty 'Barcode' field with unique values from a number range. Event handling that reacts to the triggering events 'Create' and/or 'Modify' (see [Common action event](/v1/docs/en/core-common-action-event)) allows missing barcodes to be added in time before the transaction is completed when clicking on 'Save'. The [Generate barcodes](/v1/docs/en/cmn-generate-barcodes-actor) event action generates barcodes via a specific [Number range type](/v1/docs/en/core-number-range-type) (see [Number range](/v1/docs/en/core-number-range)) in order to assign these 'empty' instances of barcode attributes to *relevant line items of a reference object* of the [Common business object](/v1/docs/en/orchestration-common-bto) type as 'Barcode' (`barcode`). *Relevant line items* can alternatively be defined using one of the following methods: - The **Line items** parameter allows an explicit definition of the *relevant line items* via a [Resolvers](/v1/docs/en/core-i-value-resolver) that provides a list of **Line items** (e.g. [Direct line items](/v1/docs/en/base-get-line-items-resolver) and/or [Rule list resolver](/v1/docs/en/core-list-rule-resolver)). - The **Line item types** parameter defines one or more **Line item types** by multiple selection (see [Line item type](/v1/docs/en/base-line-item-type)). All line items that belong to a selected [Line item type](/v1/docs/en/base-line-item-type) are considered to be *relevant*. - If no information is available for any of these parameters, all line items with the [Line item type](/v1/docs/en/base-line-item-type) 'Default' (`DEFAULT`) are considered relevant. All *relevant line items* are processed according to the following schema: 1. If the **Sync barcodes with number of packages** option is selected in the [Generate barcodes](/v1/docs/en/cmn-generate-barcodes-actor), the number of barcode attribute instances within the line item is matched to the 'Number of packages' (`numberOfPackages`): 1. If the line item currently contains more barcode attribute instances than the **Number of packages** field specifies, then 'excess' instances of the barcode attribute are removed from the end of the list. It does not matter if they are already assigned barcodes. 2. If the item currently contains fewer barcode attribute instances than the **Number of packages** field indicates, then additional instances of the barcode attribute are added to the list at the end. 2. All barcode attributes contained in the item whose 'Barcode' (`barcode`) field is empty are assigned an automatically generated value depending on the specified [Number range type](/v1/docs/en/core-number-range-type). **NOTE:** Which of the [Number range](/v1/docs/en/core-number-range) configured for the selected [Number range type](/v1/docs/en/core-number-range-type) are used to generate barcode values depends on the evaluation of their [Association criteria](/v1/docs/en/core-association-criteria) according to the *best-matching* principle. **IMPORTANT:** If no number range is assigned for the [Number range type](/v1/docs/en/core-number-range-type) for the call context or the assigned number range does not provide any more values, some or all 'Barcode' fields will not be populated. If this results in barcode duplicates for the same line item, the *reference* *object* cannot be saved in this state (see 'Barcode attributes background', above). ## Configuration The [Generate barcodes](/v1/docs/en/cmn-generate-barcodes-actor) event action expects a [Common business object](/v1/docs/en/orchestration-common-bto) as the *reference* *object*. In the context of another object type, the event action has no effect without an error occurring at runtime. | The selection for the **Number range type** parameter (required field) controls which [Number range](/v1/docs/en/core-number-range) are candidates for generating barcode values. The selection is made by association according to the *best-matching* principle (see [Association criteria](/v1/docs/en/core-association-criteria)). The **Sync barcodes with number of packages** option can be selected to ensure that the number of barcode attribute instances exactly matches the 'number of packages' (`numberOfPackages`) of the line item for all relevant line items. Based on the given 'Number of packages' line items, 'surplus' barcode attribute instances are removed or 'missing' ones are added as required for this purpose and automatically assigned a barcode value from the applicable number range. The **Sync barcodes with number of packages** option is deselected by default. Then the 'Barcode' field – if empty – is only filled for barcode attribute instances that already exist in the volatile data of the *reference* *object*. | ![images/download/attachments/78255453/image2021-8-20_21-36-48-version-1-modificationdate-1629488210996-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2021-8-20_21-36-48-version-1-modificationdate-1629488210996-api-v2.png) | | --- | --- | | The **Line items** parameter can be used to explicitly define, via a [Resolvers](/v1/docs/en/core-i-value-resolver), *relevant* *line* *items* whose barcode attributes are processed by the event action. - In the example on the right, all direct line items for the [Line item type](/v1/docs/en/base-line-item-type) 'Service' are determined via the [Direct line items](/v1/docs/en/base-get-line-items-resolver) value resolver. **NOTE:** The result for the selection of *relevant line items* is identical to the selection of 'Service' in the **Line item types** parameter (see below) only if the *reference* *object* for this [Line item type](/v1/docs/en/base-line-item-type) does not contain any child items. Otherwise, child items are not processed because the [Direct line items](/v1/docs/en/base-get-line-items-resolver) value resolver does not list them. - As soon as a [Resolvers](/v1/docs/en/core-i-value-resolver) is configured for the **Line items** parameter, the **Line item types** disactivated parameter appears. It becomes active again only when the [Resolvers](/v1/docs/en/core-i-value-resolver) in the **Line** [Resolvers](/v1/docs/en/core-i-value-resolver) parameter is removed. - The parameter can only be configured if no **Line item types** (see below) have been selected yet. | ![images/download/attachments/78255453/image2021-8-20_21-37-50-version-1-modificationdate-1629488273738-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2021-8-20_21-37-50-version-1-modificationdate-1629488273738-api-v2.png) | | Alternatively, the **Line item types** parameter can be used to define *relevant* *line* *items* whose barcode attributes are to be processed by the event action in a blanket manner via their [Line item type](/v1/docs/en/base-line-item-type). - In the example on the right, the [Line item type](/v1/docs/en/base-line-item-type) 'Default' has already been selected. In addition, the [Line item type](/v1/docs/en/base-line-item-type) 'Service' is selected, which was looked up in the image using the search function of the [Multiselect combobox](/v1/docs/en/fre-multi-select-combo-box-vo). This selection must be confirmed by pressing the enter key or by clicking on the ![images/s/-95e2zf/9012/8yg2g7/_/images/icons/emoticons/check.svg](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/check(7).svg) symbol. - A selection for **Line item types** is only possible if no explicit definition of the *relevant* *line* *items* is configured under **Line Items**. - As soon as a selection is made for one or more **Line** **item** **types**, the configuration for the **Line** **items** parameter is deactivated. **NOTE:** Only if there is neither a configuration under **Line items** nor a selection under **Line item** **types**, all line items with the [Line item type](/v1/docs/en/base-line-item-type) 'Default' (`DEFAULT`) are considered as relevant. | ![images/download/attachments/78255453/image2021-8-20_21-38-22-version-1-modificationdate-1629488304991-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2021-8-20_21-38-22-version-1-modificationdate-1629488304991-api-v2.png) | ## Example ### Simple example When saving a general business object, a barcode attribute is automatically generated at line item level for the [Line item type](/v1/docs/en/base-line-item-type) 'Default' for each package and filled with a value from a number range set up for this purpose. As the following screenshot illustrates, the input form allows changes to the **Number of packages** of a line item. In addition, new line items can be added by ![images/s/-95e2zf/9012/8yg2g7/_/images/icons/emoticons/add.svg](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/add(17).svg) and removed by ![images/s/-95e2zf/9012/8yg2g7/_/images/icons/emoticons/forbidden.svg](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/forbidden(14).svg) . ![images/download/attachments/78255453/image2021-8-20_21-39-18-version-1-modificationdate-1629488361546-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2021-8-20_21-39-18-version-1-modificationdate-1629488361546-api-v2.png) - Already generated barcodes appear read-only in the 'Barcode' field. However, an existing barcode attribute instance can be deleted altogether by clicking on the associated ![images/s/-95e2zf/9012/8yg2g7/_/images/icons/emoticons/forbidden.svg](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/forbidden(14).svg) symbol again. - The number of barcode attribute instances per line item can therefore differ from the 'Number of packages'. Before saving, any surplus barcode attributes should be deleted and any missing ones added. Configuration: Within an event handling that reacts to the 'Create' and 'Modify' of a general business object ([Check type](/v1/docs/en/core-check-type-rule)), one of the following configurations can be used for the [Generate barcodes](/v1/docs/en/cmn-generate-barcodes-actor) event action: | Variant 1 | Variant 2 | Variant 3 | | --- | --- | --- | | ![images/download/attachments/78255453/image2021-8-20_21-41-45-version-1-modificationdate-1629488508051-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2021-8-20_21-41-45-version-1-modificationdate-1629488508051-api-v2.png) | ![images/download/attachments/78255453/image2021-8-20_21-42-16-version-1-modificationdate-1629488539340-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2021-8-20_21-42-16-version-1-modificationdate-1629488539340-api-v2.png) | ![images/download/attachments/78255453/image2021-8-20_21-43-0-version-1-modificationdate-1629488583217-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2021-8-20_21-43-0-version-1-modificationdate-1629488583217-api-v2.png) | - Variant 1: The *relevant line items* (all default line items) are determined overall based on the default rule for no configuration under **Line items** and no selection for **Line item types**. - Variant 2: The *relevant items* (all default line items) are determined overall based on the selection of 'Default' under **Line item types**. - Variant 3: The *relevant items* (all direct default line items) are determined explicitly using the value resolver of the [Direct line items](/v1/docs/en/base-get-line-items-resolver) type. **NOTE:** Variant 3 is the same as the other variants only for *reference objects* that do not use child items for default line items. Runtime example: Starting from the data state for a general business object shown in the screenshot above, the following image appears after saving: | Before saving | After saving | | --- | --- | | ![images/download/attachments/78255453/image2021-8-20_21-39-56-version-1-modificationdate-1629488399391-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2021-8-20_21-39-56-version-1-modificationdate-1629488399391-api-v2.png) | ![images/download/attachments/78255453/image2021-8-20_21-43-55-version-1-modificationdate-1629488638620-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2021-8-20_21-43-55-version-1-modificationdate-1629488638620-api-v2.png) | | - There are no barcode attributes yet. | - Barcode attributes were added to match the 'Number of packages' and filled from the addressed number range. | The general business object enhanced with barcodes is now revised once again in this way: | Before saving | After saving | | --- | --- | | ![images/download/attachments/78255453/image2021-8-20_21-44-46-version-1-modificationdate-1629488689762-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2021-8-20_21-44-46-version-1-modificationdate-1629488689762-api-v2.png) | ![images/download/attachments/78255453/image2021-8-20_21-45-17-version-1-modificationdate-1629488720461-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2021-8-20_21-45-17-version-1-modificationdate-1629488720461-api-v2.png) | | - The number of packages per line item is uniformly set to 2. - The barcode of the first line item is removed by clicking ![images/s/-95e2zf/9012/8yg2g7/_/images/icons/emoticons/forbidden.svg](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/forbidden(14).svg). | - In line item 1, a barcode attribute instance has been added. Both barcodes have been reassigned. - Line item 2 is unchanged. - In line item 3, the last has been removed. | ## More complex example Based on the 'Simple example' above, it should be possible to create 'Service' line items in addition to 'Default' line items in the general business object. The 'Service' line items are also automatically barcoded using the same [Number range type](/v1/docs/en/core-number-range-type) ('Barcode'). However, with a slightly different logic: - There is no maintenance for the 'Number of packages' for the 'Service' line item. - A 'Service' line item optionally receives none, one or more barcodes, depending on how many instances the user interactively creates before saving. - When saving, a barcode should be automatically assigned to all barcode attribute instances in 'Service' line items IF the text attribute 'Service code' of the line item has been defined. - Without 'Service code' no barcode attribute instance should be able to be added to the 'Service' line item. - When removing the 'Service code' in a line item, existing barcode attribute instances are deleted. Runtime example: | - Two barcodes were requested for the 'Service' line item SER1. - Exactly one barcode is to be assigned to the 'Service' line item SER2. - The 'Service' line item SER3 does not receive a barcode. Here the ![images/s/-95e2zf/9012/8yg2g7/_/images/icons/emoticons/add.svg](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/add(17).svg) symbol was not clicked. That is why the ![images/s/-95e2zf/9012/8yg2g7/_/images/icons/emoticons/forbidden.svg](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/forbidden(14).svg) symbol appears inactive and the label 'Barcode' is black and not red. - No 'Service code' was specified for the 'Service' line item SER4. Therefore, no barcode attribute instance can be added. | ![images/download/attachments/78255453/image2021-8-20_21-46-34-version-1-modificationdate-1629488797051-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2021-8-20_21-46-34-version-1-modificationdate-1629488797051-api-v2.png) **NOTE:** The symbols ![images/s/-95e2zf/9012/8yg2g7/_/images/icons/emoticons/add.svg](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/add(17).svg) and ![images/s/-95e2zf/9012/8yg2g7/_/images/icons/emoticons/forbidden.svg](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/forbidden(14).svg) in the last line item are related to adding/removing a line item and not a barcode attribute instance. | | --- | --- | Configuration: | In the event handling from the previous example, another instance of the [Generate barcodes](/v1/docs/en/cmn-generate-barcodes-actor) is added and parameterized as shown on the right: - As the **Number range type**, the 'Barcode' type is selected, as above. - The option **Sync barcodes with number of packages** is deselected, since only existing attribute instances are processed. - The value resolver of the [Input object (type safe)](/v1/docs/en/core-root-entity-resolver) type is used to declare the type of *reference object* within the configuration for **Line items**. - The chained value resolver of the [Direct line items](/v1/docs/en/base-get-line-items-resolver) returns all direct line items of the 'Service' [Line item type](/v1/docs/en/base-line-item-type). - The [Rule list resolver](/v1/docs/en/core-list-rule-resolver) below 'filters' this list to the subset of the line item for which the text attribute 'Service code' is not empty. This is done by selecting the **Resolve all as list** option and then using an [Entity property rule](/v1/docs/en/core-entity-property-rule) that checks the 'Text' field (`textValue`) against `not` ([Is empty](/v1/docs/en/core-is-empty-matcher)). **NOTE:** The [Rule list resolver](/v1/docs/en/core-list-rule-resolver) can be used to define more complex 'filters'. Instead of [Direct line items](/v1/docs/en/base-get-line-items-resolver), the `lineItems` field of the *reference* *object* can also be used. Then the result list can also contain line items with different [Line item type](/v1/docs/en/base-line-item-type). | ![images/download/attachments/78255453/image2021-8-20_22-6-50-version-1-modificationdate-1629490013678-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2021-8-20_22-6-50-version-1-modificationdate-1629490013678-api-v2.png) | | --- | --- | Runtime example: | Before saving | After saving | | --- | --- | | ![images/download/attachments/78255453/image2021-8-20_21-46-34-version-1-modificationdate-1629488797051-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2021-8-20_21-46-34-version-1-modificationdate-1629488797051-api-v2.png) | ![images/download/attachments/78255453/image2021-8-20_21-47-30-version-1-modificationdate-1629488853852-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2021-8-20_21-47-30-version-1-modificationdate-1629488853852-api-v2.png) | | - For each position, several (SER1), one (SER2) or no (SER3, SER4) barcode assignments are expected when saving. | - When saving, only the 'requested' barcodes were entered into the attribute instances. | | In the same input form, both line item types can be used at the same time and literally 'side by side': ![images/download/attachments/78255453/image2021-8-20_21-48-1-version-1-modificationdate-1629488884789-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2021-8-20_21-48-1-version-1-modificationdate-1629488884789-api-v2.png) |