How to Check if Inventory Detail is Assigned in NetSuite

When working with item sublists in NetSuite, it’s often necessary to validate whether an Inventory Detail has been assigned to a transaction line. This can be achieved by retrieving the inventorydetail subrecord and checking its assignments.

let inventoryDetail = newRecord.getSublistSubrecord({

  sublistId: ‘item’,

  fieldId: ‘inventorydetail’,

  line: line

});

// Check if Inventory Detail is assigned

let inventoryAssignmentCount = inventoryDetail.getLineCount({

  sublistId: ‘inventoryassignment’

});

  • The getSublistSubrecord method is used to access the inventorydetail subrecord for a specific line in the item sublist.
  • Once you have the inventorydetail subrecord, you can call getLineCount on the inventoryassignment sublist to determine how many inventory assignments exist.
  • If inventoryAssignmentCount > 0, it means inventory details have been assigned; otherwise, no inventory has been allocated.

Leave a comment

Your email address will not be published. Required fields are marked *