Anyone have insight on how transformation work in ...
# suitetalkapi
b
Anyone have insight on how transformation work in suitetalk. I know in suitescript, you can transform a salesorder to an itemfulfillment. That gives you an object you can then fill in and submit via a separate API call. But it seems like SuiteTalk treats the "transformation" as a creation and save; not giving me the opportunity to change the details of the itemfulfillment. Documentation is a little weak here.
b
sounds like you mean REST
b
Yes
"SuiteTalk REST services"
unfortunately named.
Is there a more appropriate channel for REST services?
b
Transforming Records (Beta) documents how you specify additional fields
expect to understand how to work with Sublists if you are doing line modifications
b
Thanks. I'll keep fiddling with it.
I was able to get further. Initial issue was that I was using
line
instead of
orderLine
which was causing it to give me a an error about trying to modify a static sublist. However, now I'm getting:
Copy code
{
  "type": "<https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1>",
  "title": "Bad Request",
  "status": 400,
  "o:errorDetails": [
    {
      "detail": "Error while accessing a resource. The total inventory detail quantity must be 1.",
      "o:errorPath": "item.items[?(@.orderLine==2)]",
      "o:errorCode": "USER_ERROR"
    }
  ]
}
With request:
Copy code
{
  "item": {
    "items": [
      {
        "quantity": 1,
        "orderLine": 1,
        "inventoryDetail": {
          "quantity": 1,
          "inventoryassignment": {
            "items": [
              {
                "quantity": 1,
                "binNumber": {
                  "id": "17"
                }
              }
            ]
          }
        }
      },
      {
        "quantity": 1,
        "orderLine": 2,
        "inventoryDetail": {
          "quantity": 1,
          "inventoryassignment": {
            "items": [
              {
                "quantity": 1,
                "binNumber": {
                  "id": "22"
                }
              }
            ]
          }
        }
      }
    ]
  }
}
Its Beta, so may be buggy?
If I remove the object with orderLine === 2, it works. It actually creates a fulfillment, with both lines picked. I wonder if it is because the second can determine the bin automatically, and the first can't since that particular item exists in multiple bins.
Ah! I bet it is trying to add the detail/assignment in addition to what is already defaulting.
Yep! Adding this makes it work!
Copy code
?replace=item.inventoryDetail.inventoryassignment