Hello Have anybody experience with closing purchas...
# general
y
Hello Have anybody experience with closing purchase orders via the REST API? I've something that works most of the time
Copy code
PATCH https://<netsuite_account>.<http://suitetalk.api.netsuite.com/services/rest/record/v1/purchaseOrder/<po_id|suitetalk.api.netsuite.com/services/rest/record/v1/purchaseOrder/<po_id>>
{
 orderStatus: {
  id: "H", // for close
  refName: "H",
 },
 item: {
  items: [
   { line: 1, isClosed: true, item: { id: <item_id> } } // only for items that are not billed and received 
  ],
 },
};
but sometimes i get 400 with this error message
Error while accessing a resource. The record has been deleted since you retrieved it.
I assume this is due to custom triggers, no?
l
If I’m not wrong the line index starts at 0
y
for some reason NetSuite decided to start from 1 😅
l
I see… this error usually happen when you try to update a line that doesn’t exist… IN SS 1.0 start at 1 but SS2.0 starts at 0 😞