NettleRick
NettleRick

Reputation: 1

Transforming TO to Item Receipt via SuiteScript 2.0 when there is multiple fulfillment in TO

I’m working on transforming a Transfer Order (TO) into an Item Receipt using record.tranform in SuiteScript 2.0. In my case, there are two item fulfillments for the particular TO. However, when the Item Receipt is created, the record only includes items from one of the item fulfillments, rather than taking items from both fulfillments.

I’ve attempted to manually add the sublist items to the Item Receipt, but it failed because the sublist is static and does not allow adding or removing lines via script.

Now, I’m trying to use defaultValues to add the items, but it seems to be failing as well(Refer to the picture attached).

itemReceipt = record.transform({
    fromType: record.Type.TRANSFER_ORDER,
    fromId: orderingTransaction.internalId,
    toType: record.Type.ITEM_RECEIPT,
    isDynamic: true,
    defaultValues: {
        // Loop through the items you want to include in the item sublist
        item: [
            {
                // First line item values
                item: 1207,                   // Item ID
                quantity: 3,                  // Quantity to be received
                location: 1                   // Location ID (if applicable)
            },
            {
                // Second line item values
                item: 1161,                   // Item ID
                quantity: 4,                  // Quantity to be received
                location: 1                   // Location ID (if applicable)
            },
            {
                // Third line item values
                item: 1052,                   // Item ID
                quantity: 5,                  // Quantity to be received
                location: 1                   // Location ID (if applicable)
            }
        ]
    }
});

If anyone has experience with transform TO with multiple Item Fulfillment into Item Receipt via SuiteScript 2.0, I would really appreciate your help!

Upvotes: 0

Views: 52

Answers (1)

Reymond
Reymond

Reputation: 11

When you transform a Transfer Order (TO) into an item receipt in NetSuite, the item list will always reflect the latest fulfillment for the TO. Therefore, you can try including itemfulfillment with your fulfillment ID under defaultValues, as this will fetch the item list based on your desired fulfillment.

itemReceipt = record.transform({
    fromType: record.Type.TRANSFER_ORDER,
    fromId: orderingTransaction.internalId,
    toType: record.Type.ITEM_RECEIPT,
    isDynamic: true,
    defaultValues: {
        itemfulfillment: "<YOUR_FULFILLMENT_ID>"
    }
});

Upvotes: 0

Related Questions