how to duplicate invoices in the same salesOrder in netsuite?

165 Views Asked by At

I'm trying to replicate netsuite invoices from a sales order.

There is a sales Order that has an invoice associated to it. What i want is to create multiple invoices just like the only one, but with different tranDates. All associated with this sales order.

I've tried multiple api Urls from netsuite but none have worked, but the following seemed to be the right one:

https://{accountId}.suitetalk.api.netsuite.com/services/rest/record/v1/salesorder/55114/!transform/itemfulfillment

payload:

{
        "items": [
            {
                "item": {
                    "id": "557"
                },
                "quantity": 1
            }
        ]}
}

Obs.: the sales order has just one item.

This api post returns: Error while accessing a resource. You have an invalid sales order 55114 or the order is already closed.

I've checked and the sales Order is valid and wasn't closed.

I've tried also using:

https://{accountId}.suitetalk.api.netsuite.com/services/rest/record/v1/salesorder/55114/!transform/invoice

If I pass an empty payload, it fulfills all my sales Order at once, but If I pass just like the documentation:

{
    "item": {
        "items": [
            {
                "orderLine": 1,
                "quantity": 3
            }
        ]
    }
}

it simply returns an Internal Server Error (500) - An unexpected error occurred. Error ID: ljoqxcu01edyhf0udelmw.

And I don't get why it is an Internal Server Error.

Anyone has experience with netsuite APIs and knows how to replicate the invoices?

I've been trying to decipher this netsuite documentation, but man, it's been tough.

1

There are 1 best solutions below

1
On

You need to change the quantity fulfilled and billed in the item fulfillment and invoice records. If you fulfill all of the items the first time then Netsuite will error if you try to fulfill again. e.g., if you are billing only one item the set the fulfillment and invoice quantity to 1.