Hey there, I'm attempting to create an assembly bu...
# suitetalkapi
d
Hey there, I'm attempting to create an assembly build record off of a work order. It's close but I'm getting the error
"detail": "Error while accessing a resource. The total inventory detail quantity must be 1."
Here's my request to /record/v1/workOrder/153865227/!transform/assemblyBuild
Copy code
{
  "component": {
    "items": [
      {
        "item": "4094",
        "componentInventoryDetail": {
          "ignoreqtyvalidation": false,
          "inventoryassignment": {
            "items": [
              {
                "binNumber": "10051",
                "quantity": 1
              }
            ]
          },
          "quantity": 1
        },
        "quantity": 1
      }
    ]
  },
  "location": "1"
}
I've tried setting quantity:1 all over the place, no luck
b
Working with Sublists generally involves understanding how keys work
if you dont set the key, netsuite usually assumes you are trying to add new line instead of updating an existing one
d
hmm, but it's a new record?
oh the inventoryassignment items sublist
i don't understand what value i'd set tho
b
start by updating an existing assembly build first
its easier to learn what the key is
its sadly a process of guessing which field it is
d
so... i got this far by doing GETS
against existing builds
and do you mean the key on "inventoryassignment" or "componentInventoryDetail" ?
in the GET there was always a linenumber
but, i don't have a linenumber yet since this is a new record
i.e. "/services/rest/record/v1/assemblybuild/154351147/component/item=4094,lineNumber=1/componentInventoryDetail/inventoryassignment/9949119"
b
its going to be the key on the component sublist and the inventory assignment sublist
your error is about the quantity on the inventory detail
but you also need to set the quantity on the inventory assignments too since they also need to sum upto the quantity on the detail
d
ok! i added a bunch more values to the "componentInventoryDetail"
i'm getting a new error
will continue down this
lol n/m the other error was just due to a typo
man i'm stumped
literally adding every possible value to this body
b
what does the request look like now
d
Copy code
{
  "component": {
    "items": [
      {
        "item": "4094",
        "lineNumber": 1,
        "assemblyLevel": false,
        "binItem": true,
        "buildVariance": 0,
        "hasMembersOnBuild": false,
        "indentLevel": 0,
        "isNonInventory": false,
        "isNumbered": false,
        "isSerial": false,
        "orderLineQty": 1,
        "origQuantity": 1,
        "quantity": 1,
        "componentInventoryDetail": {
          "item": "4094",
          "ignoreqtyvalidation": false,
          "location": "1",
          "toLocation": "-1",
          "quantity": 1,
          "inventoryassignment": {
            "items": [
              {
                "quantity": 1,
                "binNumber": "10051"
              }
            ]
          }
        }
      }
    ]
  }
}
Copy code
"o:errorDetails": [
        {
            "detail": "Error while accessing a resource. The total inventory detail quantity must be 1.",
            "o:errorPath": "component.items[?(@.item==\"4094\")]",
            "o:errorCode": "USER_ERROR"
        }
    ]
i'm pretty certain the key is matching, because if i put a bad item # in i get a different error: "Error while accessing a resource. You have attempted an invalid sublist or line item operation. You are either trying to access a field on a non-existent line or you are trying to add or remove lines from a static sublist."
b
what does the get to the assembly build you are trying to update look like
d
Copy code
{
  "links": [
    {
      "rel": "self",
      "href": "services/rest/record/v1/assemblybuild/154420478"
    }
  ],
  "binItem": false,
  "class": {
    "links": [
      {
        "rel": "self",
        "href": "services/rest/record/v1/classification/9"
      }
    ],
    "id": "9",
    "refName": "APPAREL"
  },
  "component": {
    "links": [
      {
        "rel": "self",
        "href": "services/rest/record/v1/assemblybuild/154420478/component"
      }
    ]
  },
  "componentQuantitiesNeedRecalculation": false,
  "createdDate": "2022-08-12T15:34:00Z",
  "createdFrom": {
    "links": [],
    "id": "153865227",
    "refName": "Work Order #WO-7841919"
  },
  "currencyPrecision": "2",
  "customForm": {
    "id": "156",
    "refName": "Custom Assembly Build"
  },
  "effectiveBomControl": "EFFECTIVE_DATE",
  "id": "154420478",
  "initScriptRun": false,
  "inventoryDetail": {
    "links": [
      {
        "rel": "self",
        "href": "services/rest/record/v1/assemblybuild/154420478/inventoryDetail"
      }
    ]
  },
  "inventoryDetailAvail": "F",
  "inventoryDetailReq": "F",
  "inventoryDetailUiType": "MOH_STRICT_VALIDATION",
  "isNumbered": false,
  "isSerial": false,
  "item": {
    "links": [
      {
        "rel": "self",
        "href": "services/rest/record/v1/assemblyitem/510744"
      }
    ],
    "id": "510744",
    "refName": "TK-4"
  },
  "lastModifiedDate": "2022-08-12T15:34:00Z",
  "line": 0,
  "location": {
    "links": [
      {
        "rel": "self",
        "href": "services/rest/record/v1/location/1"
      }
    ],
    "id": "1",
    "refName": "MADISON"
  },
  "maxReloadDate": "9999-12-31",
  "minReloadDate": "1970-01-01",
  "orderAssemblyQty": 1,
  "origQuantity": 1,
  "postingPeriod": {
    "links": [
      {
        "rel": "self",
        "href": "services/rest/record/v1/accountingperiod/234"
      }
    ],
    "id": "234",
    "refName": "August 2022"
  },
  "prevDate": "2022-08-04",
  "qtyLmit": 1,
  "quantity": 1,
  "subsidiary": {
    "links": [
      {
        "rel": "self",
        "href": "services/rest/record/v1/subsidiary/1"
      }
    ],
    "id": "1",
    "refName": "Parent Company"
  },
  "total": 1.9,
  "tranDate": "2022-08-04",
  "tranId": "10503311"
}
also, i'm not updating an assembly build, i'm creating one
b
you wont be able to set sublist fields creating an assembly build without learning how to update it first
updates follow the same rules concerning updates
at least as far as key selection goes
you want to expand subresources on the get you do so you know what the sublists look like
d
yeah, did that
i have every step along the way
b
you didnt share the subresources
d
can do!
Copy code
/services/rest/record/v1/assemblybuild/154351147/component/item=4094,lineNumber=1
{
    "links": [
        {
            "rel": "self",
            "href": "/services/rest/record/v1/assemblybuild/154351147/component/item=4094,lineNumber=1"
        }
    ],
    "assemblyLevel": false,
    "binItem": true,
    "buildVariance": 0.0,
    "compItemName": "TK-01-XL",
    "compItemUrl": "/app/common/item/item.nl?l=T",
    "componentInventoryDetail": {
        "links": [
            {
                "rel": "self",
                "href": "/services/rest/record/v1/assemblybuild/154351147/component/item=4094,lineNumber=1/componentInventoryDetail"
            }
        ]
    },
    "componentInventoryDetailAvail": "T",
    "componentInventoryDetailReq": "T",
    "componentUiType": "LOH_STRICT_VALIDATION_INVENTORY_NOT_AVAIL",
    "hasMembersOnBuild": false,
    "indentLevel": 0,
    "isNonInventory": false,
    "isNumbered": false,
    "isSerial": false,
    "item": "4094",
    "itemCost": 1.9,
    "itemSource": {
        "id": "STOCK",
        "refName": "STOCK"
    },
    "lineNumber": 1,
    "orderLineQty": 1.0,
    "origQuantity": 1.0,
    "quantity": 1.0,
    "quantityOnHand": 544.0,
    "unitCost": 1.9
}
Copy code
/services/rest/record/v1/assemblybuild/154351147/component/item=4094,lineNumber=1/componentInventoryDetail

{
    "links": [
        {
            "rel": "self",
            "href": "/services/rest/record/v1/assemblybuild/154351147/component/item=4094,lineNumber=1/componentInventoryDetail"
        }
    ],
    "customForm": {
        "id": "-10820",
        "refName": "Standard Inventory Detail Form"
    },
    "ignoreqtyvalidation": false,
    "inventoryassignment": {
        "links": [
            {
                "rel": "self",
                "href": "/services/rest/record/v1/assemblybuild/154351147/component/item=4094,lineNumber=1/componentInventoryDetail/inventoryassignment"
            }
        ]
    },
    "item": {
        "links": [
            {
                "rel": "self",
                "href": "/services/rest/record/v1/inventoryitem/4094"
            }
        ],
        "id": "4094",
        "refName": "TK-01-XL"
    },
    "itemDescription": "ADULT TANK",
    "location": {
        "links": [
            {
                "rel": "self",
                "href": "/services/rest/record/v1/location/1"
            }
        ],
        "id": "1",
        "refName": "MADISON"
    },
    "quantity": 1.0,
    "toLocation": {
        "links": [
            {
                "rel": "self",
                "href": "/services/rest/record/v1/location/-1"
            }
        ],
        "id": "-1",
        "refName": "-1"
    }
}
Copy code
/services/rest/record/v1/assemblybuild/154351147/component/item=4094,lineNumber=1/componentInventoryDetail/inventoryassignment/9949119

{
    "links": [
        {
            "rel": "self",
            "href": "/services/rest/record/v1/assemblybuild/154351147/component/item=4094,lineNumber=1/componentInventoryDetail/inventoryassignment/9949119"
        }
    ],
    "binNumber": {
        "links": [
            {
                "rel": "self",
                "href": "/services/rest/record/v1/bin/3553"
            }
        ],
        "id": "3553",
        "refName": "A08-S03-L02-B01"
    },
    "internalId": 9949119,
    "inventoryDetail": 9946920,
    "quantity": 1.0,
    "quantityAvailable": 40.0
}
b
too many requests
d
these are the gets for all the subrecords
b
d
whaattt
ok sec
Copy code
{
  "links": [
    {
      "rel": "self",
      "href": "/services/rest/record/v1/assemblybuild/154422986?expandSubResources=true"
    }
  ],
  "binItem": false,
  "class": {
    "links": [
      {
        "rel": "self",
        "href": "/services/rest/record/v1/classification/9"
      }
    ],
    "id": "9",
    "refName": "APPAREL"
  },
  "component": {
    "links": [
      {
        "rel": "self",
        "href": "/services/rest/record/v1/assemblybuild/154422986/component"
      }
    ],
    "items": [
      {
        "links": [
          {
            "rel": "self",
            "href": "/services/rest/record/v1/assemblybuild/154422986/component/item=4094,lineNumber=1"
          }
        ],
        "assemblyLevel": false,
        "binItem": true,
        "buildVariance": 0,
        "compItemName": "TK-01",
        "compItemUrl": "/app/common/item/item.nl?l=T",
        "componentInventoryDetail": {
          "links": [
            {
              "rel": "self",
              "href": "/services/rest/record/v1/assemblybuild/154422986/component/item=4094,lineNumber=1/componentInventoryDetail"
            }
          ],
          "customForm": {
            "id": "-10820",
            "refName": "Standard Inventory Detail Form"
          },
          "ignoreqtyvalidation": false,
          "inventoryassignment": {
            "links": [
              {
                "rel": "self",
                "href": "/services/rest/record/v1/assemblybuild/154422986/component/item=4094,lineNumber=1/componentInventoryDetail/inventoryassignment"
              }
            ],
            "items": [
              {
                "links": [
                  {
                    "rel": "self",
                    "href": "/services/rest/record/v1/assemblybuild/154422986/component/item=4094,lineNumber=1/componentInventoryDetail/inventoryassignment/9964476"
                  }
                ],
                "binNumber": {
                  "links": [
                    {
                      "rel": "self",
                      "href": "/services/rest/record/v1/bin/3553"
                    }
                  ],
                  "id": "3553",
                  "refName": "A08-S03-L02-B01"
                },
                "internalId": 9964476,
                "inventoryDetail": 9962276,
                "quantity": 1,
                "quantityAvailable": 32
              }
            ],
            "totalResults": 1
          },
          "item": {
            "links": [
              {
                "rel": "self",
                "href": "/services/rest/record/v1/inventoryitem/4094"
              }
            ],
            "id": "4094",
            "refName": "TK-01"
          },
          "itemDescription": "ADULT TANK  - BLACK - XL",
          "location": {
            "links": [
              {
                "rel": "self",
                "href": "/services/rest/record/v1/location/1"
              }
            ],
            "id": "1",
            "refName": "MADISON"
          },
          "quantity": 1,
          "toLocation": {
            "links": [
              {
                "rel": "self",
                "href": "/services/rest/record/v1/location/-1"
              }
            ],
            "id": "-1",
            "refName": "-1"
          }
        },
        "componentInventoryDetailAvail": "T",
        "componentInventoryDetailReq": "T",
        "componentUiType": "LOH_STRICT_VALIDATION_INVENTORY_NOT_AVAIL",
        "hasMembersOnBuild": false,
        "indentLevel": 0,
        "isNonInventory": false,
        "isNumbered": false,
        "isSerial": false,
        "item": "4094",
        "itemCost": 1.9,
        "itemSource": {
          "id": "STOCK",
          "refName": "STOCK"
        },
        "lineNumber": 1,
        "orderLineQty": 1,
        "origQuantity": 1,
        "quantity": 1,
        "quantityOnHand": 538,
        "unitCost": 1.9
      },
      {
        "links": [
          {
            "rel": "self",
            "href": "/services/rest/record/v1/assemblybuild/154422986/component/item=109770,lineNumber=2"
          }
        ],
        "assemblyLevel": false,
        "binItem": false,
        "buildVariance": 0,
        "compItemName": "ELV770",
        "compItemUrl": "/app/common/item/item.nl?l=T",
        "componentInventoryDetail": {
          "links": [
            {
              "rel": "self",
              "href": "/services/rest/record/v1/assemblybuild/154422986/component/item=109770,lineNumber=2/componentInventoryDetail"
            }
          ],
          "inventoryassignment": {
            "links": [
              {
                "rel": "self",
                "href": "/services/rest/record/v1/assemblybuild/154422986/component/item=109770,lineNumber=2/componentInventoryDetail/inventoryassignment"
              }
            ],
            "items": [],
            "totalResults": 0
          }
        },
        "componentInventoryDetailAvail": "F",
        "componentInventoryDetailReq": "F",
        "componentUiType": "MOH_STRICT_VALIDATION",
        "hasMembersOnBuild": true,
        "indentLevel": 0,
        "isNonInventory": false,
        "isNumbered": false,
        "isSerial": false,
        "item": "109770",
        "itemCost": 0,
        "itemSource": {
          "id": "STOCK",
          "refName": "STOCK"
        },
        "lineNumber": 2,
        "orderLineQty": 1,
        "origQuantity": 1,
        "quantity": 1
      }
    ],
    "totalResults": 2
  },
  "componentQuantitiesNeedRecalculation": false,
  "createdDate": "2022-08-12T15:48:00Z",
  "createdFrom": {
    "links": [],
    "id": "153865227",
    "refName": "Work Order #WO-7841919"
  },
  "currencyPrecision": "2",
  "custbody2": false,
  "custbody_c9_tre_is_reprint": false,
  "custbody_mi_mfg_child_purchase_order": {
    "links": [
      {
        "rel": "self",
        "href": "/services/rest/record/v1/assemblybuild/154422986/custbody_mi_mfg_child_purchase_order"
      }
    ],
    "count": 0,
    "hasMore": false,
    "items": [],
    "offset": 0,
    "totalResults": 0
  },
  "custbody_tre_2b_printed_groups": {
    "links": [
      {
        "rel": "self",
        "href": "/services/rest/record/v1/assemblybuild/154422986/custbody_tre_2b_printed_groups"
      }
    ],
    "count": 0,
    "hasMore": false,
    "items": [],
    "offset": 0,
    "totalResults": 0
  },
  "custbody_tre_mktplc_settle_impts": {
    "links": [
      {
        "rel": "self",
        "href": "/services/rest/record/v1/assemblybuild/154422986/custbody_tre_mktplc_settle_impts"
      }
    ],
    "count": 0,
    "hasMore": false,
    "items": [],
    "offset": 0,
    "totalResults": 0
  },
  "custbody_tre_printed_groups": {
    "links": [
      {
        "rel": "self",
        "href": "/services/rest/record/v1/assemblybuild/154422986/custbody_tre_printed_groups"
      }
    ],
    "count": 0,
    "hasMore": false,
    "items": [],
    "offset": 0,
    "totalResults": 0
  },
  "custbody_tre_qty_to_scrap": false,
  "custbody_tre_screenprint_pos": {
    "links": [
      {
        "rel": "self",
        "href": "/services/rest/record/v1/assemblybuild/154422986/custbody_tre_screenprint_pos"
      }
    ],
    "count": 0,
    "hasMore": false,
    "items": [],
    "offset": 0,
    "totalResults": 0
  },
  "custbody_tre_to_is_super": false,
  "customForm": {
    "id": "156",
    "refName": "Custom Assembly Build"
  },
  "effectiveBomControl": "EFFECTIVE_DATE",
  "id": "154422986",
  "initScriptRun": false,
  "inventoryDetail": {
    "links": [
      {
        "rel": "self",
        "href": "/services/rest/record/v1/assemblybuild/154422986/inventoryDetail"
      }
    ],
    "inventoryassignment": {
      "links": [
        {
          "rel": "self",
          "href": "/services/rest/record/v1/assemblybuild/154422986/inventoryDetail/inventoryassignment"
        }
      ],
      "items": [],
      "totalResults": 0
    }
  },
  "inventoryDetailAvail": "F",
  "inventoryDetailReq": "F",
  "inventoryDetailUiType": "MOH_STRICT_VALIDATION",
  "isNumbered": false,
  "isSerial": false,
  "item": {
    "links": [
      {
        "rel": "self",
        "href": "/services/rest/record/v1/assemblyitem/510744"
      }
    ],
    "id": "510744",
    "refName": "TK-4"
  },
  "lastModifiedDate": "2022-08-12T15:48:00Z",
  "line": 0,
  "location": {
    "links": [
      {
        "rel": "self",
        "href": "/services/rest/record/v1/location/1"
      }
    ],
    "id": "1",
    "refName": "MADISON"
  },
  "maxReloadDate": "9999-12-31",
  "minReloadDate": "1970-01-01",
  "orderAssemblyQty": 1,
  "origQuantity": 1,
  "postingPeriod": {
    "links": [
      {
        "rel": "self",
        "href": "/services/rest/record/v1/accountingperiod/234"
      }
    ],
    "id": "234",
    "refName": "August 2022"
  },
  "prevDate": "2022-08-04",
  "qtyLmit": 1,
  "quantity": 1,
  "subsidiary": {
    "links": [
      {
        "rel": "self",
        "href": "/services/rest/record/v1/subsidiary/1"
      }
    ],
    "id": "1",
    "refName": "Parent Company"
  },
  "total": 1.9,
  "tranDate": "2022-08-04",
  "tranId": "10503476"
}
b
start at updating the first line's component cost to a new value
to make sure you have the key to the component sublist correct
d
k
message has been deleted
that works
b
you want to make extra sure that the line was updated, not a new line added
d
message has been deleted
confirmed
b
then its onto the inventory assignment sublist
update the first line on the inventory assignment
you dont have many choices on the fields available there, so you might actually end up having to update the bin and the quantity
d
yeah i'll just change bin
need to take a quick call
thanks
ok
when i try to patch, i get that same error
man i wish netsuite would just show you the rest call for a change it's making
b
its why i said to to the update
d
yeah that's what i'm triyng
b
its slightly easier to work with since you have access to the record you are updating
so at this point you need to figure out what is the key to the inventory assignment
d
so that works if i pass in a
"internalid"
message has been deleted
that's what it looks like in the UI
message has been deleted
this patch works
b
that doesnt look guessable
d
but i don't have an internal ID yet in the case where i'm creating a new assemblybuild
b
hopefully there is a second field that works as a key
d
i don't think there are any other fields
inventory assignment is only binNumber, internalId, inventoryDetail, quantity
b
wrong place
the records browser is for suitescript
d
k
well i'm stumped
do i have to create the build, look it up, then edit the inventory detail!?
b
you can start a support case, though support tends to be low on beta records like assembly builds
otherwise you can use the rest api browser to see if there are any fields you missed
812 Views