I'm trying to set the inv detail for the component...
# suitescript
s
I'm trying to set the inv detail for the component(s) for assembly unbuild the code looks correct but this is the
Copy code
error name":"UNEXPECTED_ERROR","message":"An unexpected SuiteScript error has occurred","stack":["Error\n at RecordInvoker.getSublistSubrecord (suitescript/resources/javascript/record/serverRecordService.js:467:21)
var subList = assembly.getSublistSubrecord({
      sublistId: "component",
      fieldId: "componentinventorydetail",
      line: 0,
    });
    subList.setSublistValue({
      sublistId: "inventoryassignment",
      fieldId: "quantity",
      line: 0,
      value: lotqty,
    });
    subList.setSublistValue({
      sublistId: "inventoryassignment",
      fieldId: "issueinventorynumber",
      line: 0,
      value: "lot",
    });
is the inv detail for the component on an assembly unbuild a sublist sub-record ?
b
general hint for inventory detail transactions is that
Serial/Lot Number
is actually the label for 2 different fields
receiptinventorynumber
is used when your inventory increases
issueinventorynumber
is used when your inventory decreases
your current error looks related to getting the sublist's subrecord
for this record, you will probably need to use dynamic mode, the component sublist is filled in after you fill in the appropriate body fields
you might be able to do it using standard mode if you can use default values to fill in those fields
s
would you know the keys for default values
Copy code
assembly.setValue({ fieldId: "subsidiary", value: 2 });
    assembly.setValue({ fieldId: "item", value: data.id });
    assembly.setValue({ fieldId: "location", value: "14" });
    assembly.setValue({
      fieldId: "quantity",
      value: qty,
    });
THANK YOU @battk I'm getting a new error I'm not able to set the lot number this is in dynamic mode
Copy code
if (data.values["islotitem.memberItem"] == "T") {
        var invsub = assembly.getCurrentSublistSubrecord({
          sublistId: "component",
          fieldId: "componentinventorydetail",
        });
        invsub.selectNewLine({
          sublistId: "inventoryassignment",
        });
        invsub.setCurrentSublistValue({
          sublistId: "inventoryassignment",
          fieldId: "issueinventorynumber",
          value: "lot",
        });
        invsub.setCurrentSublistValue({
          sublistId: "inventoryassignment",
          fieldId: "quantity",
          value: lotqty,
        });

        invsub.commitLine({
          sublistId: "inventoryassignment",
        });
        assembly.commitLine({
          sublistId: "component",
        });
{"type":"error.SuiteScriptError","name":"USER_ERROR","message":"Please enter value(s) for: Serial/Lot Number","stack":["Error\n at RecordInvoker.commitLine (suitescript/resources/javascript/record/serverRecordService.js:278:5)\n at NetSuiteObject.thenableFunction() (suitescript/resources/javascript/record/proxy.js:115:24)\n at Object.map (/SuiteScripts/assembly/breakdownassembly.js:107:16)"],"cause":{"type":"internal error","code":"USER_ERROR","details":"Please enter value(s) for: Serial/Lot Number","userEvent":null,"stackTrace":["Error\n at RecordInvoker.commitLine (suitescript/resources/javascript/record/serverRecordService.js:278:5)\n at NetSuiteObject.thenableFunction() (suitescript/resources/javascript/record/proxy.js:115:24)\n at Object.map (/SuiteScripts/assembly/breakdownassembly.js:107:16)"],"notifyOff":false},"id":"","notifyOff":false,"userFacing":true}
b
its the first hint i gave you
s
But this is the component inv which is going up
oh my mistake i confused them again