RE: REST API to upsert invoice line items

I need to be able to upsert line items in a NetSuite invoice with updated information from an external system.

I’ve tried to apply an internalId and externalId to the line item so I can target for update, however it doesn’t appear to be saved against the line item when GETing it back from the API.


My invoice creation payload is

"tranDate": "2021-07-12", 
"dueDate": "2021-07-19", 
"externalId": "sysA_INV-34698", 
"amountPaid": 0, 
"entity": {
    "id": 3127
"item": {
    "items": [ 
            "item": { 
                "id": 374
            "internalId": "sysA_INV-34698_JOBID-4875398"
            "quantity": 1, 
            "rate": 534.54


any ideas how I can update/upsert a line item, or do I have to delete all items and re add them every time?

CousinLarry Rookie Asked on July 12, 2021 in SuiteCloud.
Add Comment
3 Answers

Right thanks – so the flow would be (Option 1)

  1. Get all line items of the invoice using the endpoint at GET /record/v1/invoice/3210/item
  2. Query each one (endpoint: GET  /record/v1/invoice/3210/item/15, 16, 17, etc) and figure out if any change needs to be applied
  3. Make the change using  PUT on /record/v1/invoice/3210/item/15, 16, 17, etc

Or Option 2, I could just

  1. Delete all line items
  2. Recreate them

Are there any disadvantages to doing Option 2?

Rookie Answered on July 12, 2021.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.