0

Any suggestions are greatly appreciated!

The sales orders can have 50-100 lines. Each SO will have multiple item fulfillments. When we create the IF through SuiteTalk, we don't know which lines are already fulfilled or which lines are partially fulfilled.

When I create the soap, I am overriding the item list.

The code works fine if there is only 2 items on the sales order and all lines are being fulfilled.

The trouble arises when another process has added / deleted items on the sales order thus causing an order with 5 lines to have soLines such as 1, 45, 245, 300 & 301. If I am trying to fulfill line 245, I will receive VALID_LINE_ITEM_REQD.

Would anyone have suggestions on what needs to be initialized?

Thank you in advance,

Bill


Below is a sample request/response.

Request

<record xmlns:q1="urn:sales_2020_1.transactions.webservices.netsuite.com" xsi:type="q1:ItemFulfillment" externalId="mrk-so-2446425">
<q1:createdFrom internalId="2446425"/>
<q1:shippedDate>2020-12-25T06:00:00Z</q1:shippedDate>
<q1:shipStatus>_shipped</q1:shipStatus>
<q1:tranDate>2020-12-25T06:00:00Z</q1:tranDate>
<q1:generateIntegratedShipperLabel>false</q1:generateIntegratedShipperLabel>
<q1:itemList>
<q1:item>
<q1:location internalId="308"/>
<q1:quantity>1</q1:quantity>
<q1:item internalId="82198"/>
<q1:orderLine>101</q1:orderLine>
</q1:item>
</q1:itemList>
</record>

Response

<writeResponse>
<platformCore:status xmlns:platformCore="urn:core_2020_1.platform.webservices.netsuite.com" isSuccess="false">
<platformCore:statusDetail type="ERROR">
<platformCore:code>VALID_LINE_ITEM_REQD</platformCore:code>
<platformCore:message>You must have at least one valid line item for this transaction.</platformCore:message>
</platformCore:statusDetail>
</platformCore:status>
<baseRef xmlns:platformCore="urn:core_2020_1.platform.webservices.netsuite.com" type="itemFulfillment" xsi:type="platformCore:RecordRef" externalId="mrk-so-2446425"/>
</writeResponse>
bllqnn
  • 5
  • 5

2 Answers2

0
You must have at least one valid line item for this transaction

This is cause for a lot reasons:

  • That line (item) doesn´t exists in this SO
  • That item doesn´t have available quantity (all backordered)
  • that line is closed
  • wrong internalid for the item

after you made the first fulfillment review your SO (partially fulfillment) and verify you remant lines

After you transform your SO to fulfillment

var itemFulfillMent = record.transform( {
                fromType: context.createdfrom.recordType,
                fromId: context.createdfrom.id,
                toType: 'itemfulfillment',
                isDynamic: true,
            } );

make a array with (line, item)

    var itemsPosition = {};
    for ( var i = 0; i < itemFulfillMent.getLineCount( 'item' ); i ++ ) {
            itemsPosition[ itemFulfillMent.getSublistValue( 'item',  'item', i ) ] = i;
}

in the itemsPosition you will now know line of your item.

wozzarvl
  • 304
  • 4
  • 17
  • @wozzarl - thank you for the reply. Quantity is available, the line is not closed and the internal id is correct. What field on the sales order line would you use for the orderLine field on the Item fulfillment? – bllqnn Mar 04 '21 at 01:43
0

Did you start your item fulfillment with an initialize call?

ItemFulfillmentItem has a field 'orderLine'. This matches with the SalesOrderItem 'line' field.

If what you actually want to fulfill can be calculated from the SO information then I just do a reverse loop through the fulfillment lines, using the orderLine value to key into the SalesOrder and remove any fulfillment lines that shouldn't be on this fulfillment.

bknights
  • 14,408
  • 2
  • 18
  • 31