is it possible via script to unbuild assembly ( us...
# suitescript
s
is it possible via script to unbuild assembly ( using map/reduce)
i should have made my question clear , where is the docs for assembly unbuild
b
s
thanks @battk which fields are required i should follow the list in records browser ?
Copy code
var assembly = record.create({
          type: record.Type.ASSEMBLY_UNBUILD,
      });
      assembly.setValue({ fieldId: "subsidiary", value: 2 });
      assembly.setValue({ fieldId: "item", value: data.id }); 
      assembly.setValue({ fieldId: "location", value:"14" });
      assembly.setValue({ fieldId: "quantity", value: data.qty });

      assembly.setSublistValue({
          sublistId: "component",
          fieldId: quantity,
          line: 0,
          value: qty
      });
      var subList = assembly.getSublistSubrecord({
          sublistId: "component",
          fieldId: "componentinventorydetai",
          line: 0,
      });
      subList.setSublistValue({
          sublistId: "inventoryassignment",
          fieldId: "quantity",
          line: 0,
          value: qtysubmit,
      });
      subList.setSublistValue({
          sublistId: "inventoryassignment",
          fieldId: "issueinventorynumber",
          line: 0,
          value: lotNumber,
      });
the inv detail on line item of a transfer order since it is a line item for unbuilding assembly there are two diffrent inv details needed the main and item what would the main syntax be ?
Copy code
var subList = ifRec.getSublistSubrecord({
              sublistId: "item",
              fieldId: "inventorydetail",
              line: i,
            });
b
basics for working with records is to learn how to create the record in the ui, then set those same fields you used in the ui in script
Record.getSubrecord is used to access body level subrecords
s
thank you @battk im try to set the lot number for the copmonent
Copy code
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",
    });
r
Take a look here, I haven't tried it yet: https://stackoverflow.com/questions/68689396/how-get-lot-serial-number-in-netsuite-suitescript-2-0-for-inventory-adjustment-t Looks like you need to do a get instead of the set on the issueinventorynumber, then the lot is on the 'inventorynumber'
s
thank you