Sapo Trường Tùy Chỉnh icon

Sapo Trường Tùy Chỉnh

Quản lý trường tùy chỉnh trên Sapo

Đơn Hàng → Cập Nhật

AI-generated

Overview

This node manages custom metafields on various resources within the Sapo platform, such as orders, products, customers, and more. Specifically for the "Đơn Hàng" (Orders) resource with the "Cập Nhật" (Update) operation, it updates an existing custom metafield associated with a particular order.

Use cases include:

  • Modifying metadata related to an order, such as updating warehouse location, delivery instructions, or any custom data tracked via metafields.
  • Keeping order-related custom fields current without manually editing them in the Sapo admin interface.
  • Automating updates to order metadata based on external triggers or workflows.

Example: Automatically update the "warehouse_location" metafield of an order when inventory is moved, ensuring accurate tracking of where the order's items are stored.

Properties

Name Meaning
ID Tài Nguyên The unique numeric identifier of the order resource to update.
ID Trường Tùy Chỉnh The unique numeric identifier of the custom metafield to update on the specified order.
Dữ Liệu Trường Tùy Chỉnh JSON object containing the metafield data to update. Includes keys like namespace, key, value, value_type, and description.

The Dữ Liệu Trường Tùy Chỉnh property expects a JSON structure similar to:

{
  "namespace": "inventory",
  "key": "warehouse_location",
  "value": "A-12",
  "value_type": "string",
  "description": "Storage location in warehouse"
}

Output

The node outputs an array with one element containing a json field representing the updated metafield object returned from the API. This object includes details about the metafield after the update operation.

If the update fails and the node is set to continue on failure, the output will contain an error message inside the json field.

No binary data is produced by this node.

Dependencies

  • Requires an active connection to the Sapo API via an API key credential configured in n8n.
  • The node depends on the internal SapoApiBase class to interact with the metafields endpoint of the Sapo API.
  • Proper permissions on the Sapo account to update metafields on orders are necessary.

Troubleshooting

  • Common issues:
    • Invalid or missing resourceId or metafieldId will cause the update to fail.
    • Malformed JSON in the data property can lead to errors.
    • Insufficient API permissions or expired credentials may result in authentication errors.
  • Error messages:
    • Errors thrown by the API are caught and either stop execution or are returned in the output if "Continue On Fail" is enabled.
    • Typical error messages include invalid IDs, unauthorized access, or validation failures on metafield data.
  • Resolution tips:
    • Verify that the order ID and metafield ID exist and are correct.
    • Ensure the JSON structure for the metafield data matches expected schema.
    • Check API credentials and permissions.
    • Use the node’s built-in validation operation to test metafield data before updating.

Links and References

Discussion