Scenario:
If we want to get the exact line from which the item in Item Fulfillment is selected (mostly required if same items are added multiple times in Sales order) we can use of ‘orderline‘ field in IF record and ‘line‘ field in SO record. The line field value in SO will be populated in orderline field in IF record. i.e both will hold the same value.
Code snippet:
This is a code snippet from user event script deployed on IF record.
var itemLineCount = ifRec.getLineCount({sublistId: 'item'});
for (var j = 0; j < itemLineCount; j++) {
var orderLine = ifRec.getSublistValue({
sublistId: 'item',
fieldId: 'orderline',
line: j
});
log.debug("orderLine", orderLine);
var itemLine = soRec.findSublistLineWithValue({
sublistId: 'item',
fieldId:'line',
value:Number(orderLine)
});
}
Here itemLine is the index of item in the Sales order.