0

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.

  • You cannot directly do what you are trying. You can duplicate invoices and clear the duplicate's 'createdfrom' field. That may accomplish what you want. Can you provide more details about the actual use case? – bknights Jul 05 '23 at 21:51
  • If I leave the createdFrom field when only trying to create an invoice, I'm able to create, but the invoice doesn't get linked to the sales Order. What we are trying to do is: We create a sales order and the first invoice (relative to multiple payments) through the UI. Since this first invoice is only a piece of this sales order, we are trying to replicate this invoice untill the sales order is complete. e.g. Sales Order with 1 item with quantity 10. I want all invoices to have quantity 1, so 10 invoices. In the UI i can create replicas individually, wich takes time. That's why I'm using API – Gustavo Poli Jul 07 '23 at 12:17

1 Answers1

0

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.

bknights
  • 14,408
  • 2
  • 18
  • 31
  • When I do so, the error is different than this 500 - Internal Error. To test after fulfilling all items, I entered the netsuite UI and deleted the created invoice and tried to run again defining the quantity. That's when I get this internal error. – Gustavo Poli Jul 09 '23 at 13:34