Hi, does anyone have an example suitescirpt that a...
# suitescript
k
Hi, does anyone have an example suitescirpt that allows me to receive inbound shipments? Or do I need to find all PO in an inbound shipment to receive per PO?
b
k
Hi Battk, i seem to keep getting getSublist is not a function
Copy code
const bulkReceive = record.load({
    type: record.Type.RECEIVE_INBOUND_SHIPMENT,
    id: shipmentId,
    isDynamic: true,
  });
  const lineCount = bulkReceive.getLineCount({
    sublistId: "receiveitems",
  });
  for (let i = 0; i < lineCount; i++) {
    //Set receieve check box to true, use get and set sublist value
    bulkReceive.setSublistValue({
      sublistId: "receiveitems",
      fieldId: "receiveitem",
      line: i,
      value: true,
    });
}
I'm trying to set the checkbox of each of the item to true
Done, figured it out and built the whole thing
j
Hey @Ken Sorry to bring this thread back up, but I am founding the same problem that getSublist is not a function, how did you solve it??
k
@Juan sorry I do not look at this often. I've went with a more dynamic approach
Copy code
const bulkReceive = record.load({
    type: record.Type.RECEIVE_INBOUND_SHIPMENT,
    id: shipmentId,
    isDynamic: true,
  });

const lineCount = bulkReceive.getLineCount({
    sublistId: "receiveitems",
  });

  for (let i = 0; i < lineCount; i++) {
    bulkReceive.selectLine({
      sublistId: "receiveitems",
      line: i,
    });
    const item = bulkReceive.getCurrentSublistValue({
      sublistId: "receiveitems",
      fieldId: "item",
    });
    const poId = bulkReceive.getCurrentSublistValue({
      sublistId: "receiveitems",
      fieldId: "purchaseorder",
    });
    const lineId = bulkReceive.getCurrentSublistValue({
      sublistId: "receiveitems",
      fieldId: "id",
    });