https://netsuiteprofessionals.com logo
#suitescript
Title
# suitescript
s

Sim Greenbaum

03/23/2022, 3:09 PM
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

battk

03/24/2022, 12:07 AM
s

Sim Greenbaum

03/24/2022, 4:37 PM
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

battk

03/24/2022, 9:05 PM
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

Sim Greenbaum

03/28/2022, 5:21 PM
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

Robert Vice

04/01/2022, 12:54 PM
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

Sim Greenbaum

04/01/2022, 2:32 PM
thank you
12 Views