This topic contains 3 replies, has 0 voices, and was last updated by Olivier Gagnon NC 6 years, 10 months ago.

  • Author
    Posts
  • #18188

    darrenhillconsulting

    Please tell me this has been done … and I’ve not run into a SS2 Bug. Its very simple, I’m fully receiving a PO and need to add the Lot Number to the line.

    Code:
    var itemReceipt = record.transform({fromType: ‘purchaseorder’, fromId: 1, toType: record.Type.ITEM_RECEIPT, isDynamic: true});

    itemReceipt.selectLine({ sublistId: ‘item’, line: 0 });
    itemReceipt.setCurrentSublistValue({ sublistId: ‘item’, fieldId: ‘itemreceive’, value: true });
    itemReceipt.setCurrentSublistValue({ sublistId: ‘item’, fieldId: ‘quantity’, value: ‘5’ });

    var inventoryDetail = itemReceipt.getCurrentSublistSubrecord({ sublistId: ‘item’, fieldId: ‘inventorydetail’ });
    inventoryDetail.selectNewLine({ sublistId: ‘inventoryassignment’ });
    inventoryDetail.setCurrentSublistValue({ sublistId: ‘inventoryassignment’, fieldId: ‘receiptinventorynumber’, value: ‘FAKE_LOT’ });
    inventoryDetail.setCurrentSublistValue({ sublistId: ‘inventoryassignment’, fieldId: ‘quantity’, value: ‘5’ });
    inventoryDetail.commitLine({ sublistId: ‘inventoryassignment’ });

    itemReceipt.commitLine({ sublistId: ‘item’ });

    itemReceipt.save();
    I’m getting … “type”:”error.SuiteScriptError”,”name”:”PLEASE_CON FIGURE_THE_INVENTORY_DETAIL_FOR_1″,”message”:”Plea se configure the inventory detail for KMB008.”
    This is a cached copy. Click here to see the original post.

  • #18189

    Olivier Gagnon NC

    I suspect it might be the selectNewLine. I checked some code I have that does exactly this, and it matches all your list names and field names and stuff. So I think it might be the newLine and commit. My code doesn’t have that stuff and it works.

  • #18190

    darrenhillconsulting

    Yes Olivier, I converted the script to NOT use dynamic mode … and I’m good. Thanks!

    However, doing the same on an ItemFulfillment is 100% broken … had to resort to building an SS1.0 script for ItemFulfillments with Inventory Details. Not fun.

  • #18191

    Olivier Gagnon NC

    If I remember correctly, everything works but the huge problem is you must specify Serial Numbers by referring to their Internal ID, which makes it an incredible hassle.

You must be logged in to reply to this topic.