Replace all item lines of a sales orders lines wit...
# ask-stanley-ai
l
Replace all item lines of a sales orders lines with new ones through REST api
c
AI generated answer (using internal Slack threads):
To replace all item lines of a sales order with new ones through the REST API, you would need to perform a PUT operation on the sales order record. This operation would replace the entire sales order, including all line items. Here is a general example of how you might structure your request:
Copy code
json
{
  "recordType": "salesOrder",
  "id": "your_sales_order_id",
  "fields": {
    "entity": {
      "id": "your_customer_id"
    },
    "itemList": {
      "replaceAll": true,
      "item": [
        {
          "item": {
            "id": "new_item_id_1"
          },
          "quantity": "new_quantity_1"
        },
        {
          "item": {
            "id": "new_item_id_2"
          },
          "quantity": "new_quantity_2"
        }
        // Add more items as needed
      ]
    }
  }
}
In this example,
"replaceAll": true
is used to replace all existing line items with the new ones specified in the
"item"
array. Each item in the array represents a new line item, with
"item": {"id": "new_item_id"}
specifying the ID of the new item and
"quantity": "new_quantity"
specifying the quantity of the new item. Please note that you will need to replace
"your_sales_order_id"
,
"your_customer_id"
,
"new_item_id_1"
,
"new_quantity_1"
,
"new_item_id_2"
, and
"new_quantity_2"
with your actual sales order ID, customer ID, new item IDs, and new quantities, respectively. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.812125266
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.812045515
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.811902761
Please provide your feedback on this answer.