Update Attributes in Bulk Invocable Action

Update product attributes across multiple quote line items in a single asynchronous request without editing each line item individually.

Required Editions

Available in: Lightning Experience
Available in: Enterprise, Unlimited, and Developer Editions

Available in Flow Builder and Agentforce for flows running API version 67.0 and later, the action starts a bulk attribute update job and immediately returns an asynchronous job ID for tracking status. The Bulk Attribute Update service performs all business validation, including parent-child relationship checks and duplicate target detection, after the job starts.

Input Values

Parameter Required Description Data Type
quoteId Yes The ID of the quote whose line-item attributes are updated. String
updates Yes A JSON array of update objects. Each object requires rootQuoteLineItemId, quoteLineItemId, and an attributes array of { attributeCode, value }. String (JSON array)
validate No Optional. A Boolean value that indicates whether validation runs. The default value is true. Boolean
price No Optional. A Boolean value that indicates whether pricing is recalculated after the attribute write. The default value is true. Boolean
validateCartAfterUpdate No Optional. A Boolean value that indicates whether the cart is validated after the attribute write. The default value is true. When the cart is invalid, the chunk fails and is not copied back. Set to false to copy back regardless of validation errors. Boolean
checkAsyncJobStatus No Optional. A Boolean value that indicates whether to check for running asynchronous jobs on the quote before starting the update. The default value is true. Boolean

Output Values

Parameter Description Data Type
status The status of the request. Valid values are ACCEPTED when queued and FAILED on envelope-level rejection. String
success A Boolean value that indicates whether the request was accepted and the asynchronous job was queued. Boolean
quoteId The ID of the quote. String
asyncJobId The batch job ID for status polling. String
message A human-readable status message. String
error An error message if the request was rejected. String

Usage

Use this action when you need to update product attributes across many quote line items without updating each line item individually.

After the request is accepted, the action immediately returns an asynchronous job ID. Use the Get Async Job Status action to monitor processing status.

The action delegates all business processing to the Bulk Attribute Update service. The invocable action performs only payload validation before submitting the asynchronous request.

Note
Note Attribute codes and values aren't validated before this action runs. If you provide an invalid attribute code or value, the API call still returns success, so no error is shown. Make sure the attribute codes and values you enter are correct.

Extensibility

The Bulk Attribute Update service supports Apex hooks to trigger custom workflows during execution.

Pre-Hook

Execution & Availability: Supported via the preHook method defined in B2BCmexAPIHookInterface.

Behavior: If pre-flight validation fails during request kickoff, the call is rejected synchronously before a job is created, meaning no batch fires and no post-hook runs.

Post-Hooks

Opt-in per org (configured via bulkAttributeUpdateHook from Setup > Custom Settings > Custom Class Implementation), post-hooks fire at two execution points:

  • Immediate Post-Hook (executePostHook): Runs synchronously on request acceptance with phase=ACCEPTED right after the job is enqueued.
  • Batch-Finish Post-Hook (executePostHookForBatch): Runs once upon batch completion with phase=COMPLETED. It delivers an output payload containing successCount, failureCount, and a per-entry results[] array detailing line-level status and error messages.
Note
Note Post-hook exceptions are swallowed to prevent interrupting the main transaction or notification flow.

Considerations

  • This action supports asynchronous processing only.
  • Only one asynchronous job can run for a quote at a time unless checkAsyncJobStatus is set to false.
  • The updates input must be a valid JSON array.
  • Each update object must contain rootQuoteLineItemId, quoteLineItemId, and attributes.
  • Each entry in the attributes array must contain attributeCode and value.
  • Validation, pricing recalculation, and cart validation behavior are controlled by optional input parameters.

Example Input

{
  "quoteId": "0Q0xxxxxxxxxxxxAAA",
  "updates": [
    {
      "rootQuoteLineItemId": "0QLxxxxxxxxxxxxAAA",
      "quoteLineItemId": "0QLxxxxxxxxxxxxAAA",
      "attributes": [
        {
          "attributeCode": "VEPC_ATTR_DOWNLOAD_SPEED",
          "value": "200Mbps"
        },
        {
          "attributeCode": "VEPC_ATTR_CONTRACT_TERM",
          "value": "24Months"
        }
      ]
    },
    {
      "rootQuoteLineItemId": "0QLxxxxxxxxxxxxBBB",
      "quoteLineItemId": "0QLxxxxxxxxxxxxBBB",
      "attributes": [
        {
          "attributeCode": "VEPC_ATTR_DOWNLOAD_SPEED",
          "value": "300Mbps"
        },
        {
          "attributeCode": "VEPC_ATTR_CONTRACT_TERM",
          "value": "34Months"
        }
      ]
    }
  ],
  "validate": true,
  "price": true,
  "validateCartAfterUpdate": true,
  "checkAsyncJobStatus": true
}

Example Output

{
  "success": true,
  "quoteId": "0Q0XXXXXXXXXXXX",
  "status": "ACCEPTED",
  "asyncJobId": "707XXXXXXXXXXXX",
  "message": "Bulk attribute update accepted; poll asyncJobId for status."
}

Error Handling

The action immediately returns a FAILED status when the request cannot be accepted.

Service-level validation errors are returned in the error output using this format:

[errorCode] errorMessage

For example:

[NOTHING_TO_UPDATE] Specify at least one entry for the updates parameter.

The action rejects the request before submitting the asynchronous job when:

  • quoteId is blank.
  • updates is blank.
  • updates is not valid JSON.
  • updates is not a JSON array.