SetProductAttributesTask

Introduction

The SetProductAttributesTask uses the OMN API to persist multiple attributes in a single API call for product, article, or variant scope.

This task is the complementary "write" counterpart to GetProductAttributesTask and accepts either a map keyed by attribute identifier or a normalized list format for maximum flexibility.

Usage

Input is the ID of the target product/article/variant and either a map of attributes or a list of attribute entries. The task automatically detects the scope and validates attribute configuration and access permissions before writing.

In case of validation issues, the task provides detailed warning messages and continues processing valid attributes, making it robust for bulk operations.

Implementation

Delegate Expression: $\{setProductAttributesTask}

Input Variables

Name Description Type Required Default Value

productId

Id of the target product/article/variant

Long

Required

-

attributes

Map keyed by attribute identifier with value/locale information

Map<String,Object>

Optional*

-

attributesList

Normalized list with identifier, value, and optional locale per row

List<Map<String,Object>>

Optional*

-

pimSchemaVersion

The PimType XSD schema version to use

String

Optional

5.6.0

attributeValueDelimiter

Delimiter for joining single-valued attributes when list is provided

String

Optional

,

*Note: At least one of attributes or attributesList must be provided.

Input Format Examples

Map format (from GetProductAttributesTask map output):

{
  "Title": {
    "valuesByLocale": {
      "en-EN": ["English Title"],
      "de-DE": ["German Title"]
    }
  },
  "Weight": { "value": ["1.5"] }
}

List format (from GetProductAttributesTask list output):

[
  {"identifier": "Title", "locale": "en-EN", "value": ["English Title"]},
  {"identifier": "Title", "locale": "de-DE", "value": ["German Title"]},
  {"identifier": "Weight", "locale": null, "value": ["1.5"]}
]

Output Variables

Name Description Type

httpStatusCode

The HTTP Status Code of the REST API Call

Integer

httpResponse

The HTTP Response Body of the REST API Call

String/JSON

writeWarnings

Validation messages for skipped or adjusted entries

List<String>

attributesWritten

List of attribute identifiers included in the persist payload

List<String>

Validation & Behavior

Non-blocking Warnings (attributes are skipped):

  • Attribute must be configured for the target level (P/A/V)

  • inheritanceType must be editable (not visible or not visible)

  • Language-dependent attributes require locale information

  • Single-valued attributes with multiple values are joined using delimiter

Blocking Errors:

  • Attribute completely missing from node configuration

  • Missing required productId

Usage Notes

Direct Integration:

  • Works seamlessly with GetProductAttributesTask outputs - no conversion needed

  • outputMode=map → use as attributes input

  • outputMode=list → use as attributesList input

  • outputMode=both → choose either or provide both (task merges them)

Scope Detection:

  • Automatically detects if productId represents product, article, or variant

  • Constructs the appropriate persist structure for the OMN API

Delta Mode:

  • Only writes provided attributes, doesn’t affect others

  • Provides precise control over which attributes are modified

Performance:

  • Single API call for multiple attributes

  • Comprehensive validation with detailed warning messages

Example Usage

The task is commonly used in multi-instance subprocess to persist translated attributes:

<serviceTask id="setProductAttributesTask" name="Set Product Attributes"
    camunda:delegateExpression="${setProductAttributesTask}">
  <extensionElements>
    <camunda:inputOutput>
      <camunda:inputParameter name="productId">${productId}</camunda:inputParameter>
      <camunda:inputParameter name="attributesList">
        <camunda:script scriptFormat="groovy">
          def m = (Map) execution.getVariable('attributesListByProduct');
          def pid = execution.getVariable('productId');
          m != null ? m.get(String.valueOf(pid)) : null
        </camunda:script>
      </camunda:inputParameter>
    </camunda:inputOutput>
  </extensionElements>
</serviceTask>

Integration with GetProductAttributesTask

This task is designed to work seamlessly with GetProductAttributesTask:

  1. Use GetProductAttributesTask to read current attributes

  2. Analyze and filter the results using the map format

  3. Pass the filtered data to SetProductAttributesTask using either format

  4. Monitor writeWarnings for any validation issues

Welcome to the AI Chat!

Write a prompt to get started...