Jordan van Zyl
Jordan van Zyl

Reputation: 33

Netsuite Rest Api: Sales Order Item Fulfillment

I'm battling with the item fulfillment on a Sales Order. I'm trying to partially fulfill items on the Sales Order via the Netsuite Rest Api.

I've tried the following:

        POST https://<accountID>/services/rest/record/v1/salesorder/{{SALES_ORDER_ID}}/!transform/itemFulfillment

}

with the following payload:

    "item": {
        "items": [
            {
                "orderLine": 2,
                "location": 3,
                "quantity": 1,
                "itemreceive": true
            }
        ]
    }
}

I get the following error:

{
    "type": "https://www.rfc-editor.org/rfc/rfc9110.html#section-15.5.1",
    "title": "Bad Request",
    "status": 400,
    "o:errorDetails": [
        {
            "detail": "Error while accessing a resource. You must have at least one valid line item for this transaction.",
            "o:errorCode": "USER_ERROR"
        }
    ]
}

Other sources say to set "itemreceive" to false on the items you do not want to fulfill, but I still receive the same error:

{
    "item": {
        "items": [
            {
                "orderLine": 2,
                "location": 3,
                "quantity": 1,
                "itemreceive": false
            },
            {
                "orderLine": 22,
                "location": 3,
                "itemreceive": false
            },
            {
                "orderLine": 44,
                "location": 3,
                "itemreceive": false
            },
            {
                "orderLine": 66,
                "location": 3,
                "itemreceive": false
            }
        ]
    }
}

I do have advanced shipping enabled, does this affect item fulfillment on a sales order? If so, what do I need to do?

Any help will be greatly appreciated!

Upvotes: 1

Views: 99

Answers (2)

Alex
Alex

Reputation: 1

Try to do following:

POST method {{REST_SERVICES}}/record/v1/salesOrder

JSON object for SO creation:

{
        "Id": "sales_order_ID",
        "entity": {
            "Id": "Customer ID"
        },
        "tranDate": {{$timestamp}},
        "customForm": 173,
        "currency": {
            "id": 1
        },
        "item": {
            "items": [
                {
                    "item": {
                        "Id": "sale_item_id"
                    },
                    "quantity": 0,
                    "rate": 0
                }
            ]
        }
    }

In case if you setup in the NetSuite external ID's, you can use them, like below:

{
        "externalId": "sales_order_ID",
        "entity": {
            "externalId": "Customer ID"
        },
        "tranDate": {{$timestamp}},
        "customForm": 173,
        "currency": {
            "id": 1
        },
        "item": {
            "items": [
                {
                    "item": {
                        "externalId": "sale_item_id"
                    },
                    "quantity": 0,
                    "rate": 0
                }
            ]
        }
    }

Upvotes: 0

jakeehoffmann
jakeehoffmann

Reputation: 1419

  1. Use itemReceive rather than itemreceive.
  2. If you specify a quantity and also itemReceive false for a particular orderLine, it will be as if you had specified itemReceive true with that quantity. That is, just specify the orderLine and itemReceive false -- nothing else.
  3. It seems like the item cannot be fulfilled. Is there inventory available for that item?

In general, for the best chance of success here, put itemReceive false for each orderLine you don't want to be on the transformed record, and put itemReceive true for the ones you do. Another good idea is to do the thing in the UI that you are trying to do in the REST request. I am willing to bet that if you hit Fulfill on the Sales Order in the UI, the item you are failing to transform here will not show up in the item sublist so you will need to figure out why.

Upvotes: 0

Related Questions