Objective:
I'm trying to dynamically insert all possible subitem [cost layer and sub layer combination] that are valid / checked in Distribution->Stock Items->Cross-Reference Tab (with alternate type of: Barcode and dynamically generated AlternateID).
My presumed strategy is:
1.) to get the list of InventoryItem's list of Cost layer (that are checked) iterate thru,
2.) get the list of sub layers (that are checked), iterate thru,
3.) then compose the SubItem code by concatenating the iterated Cost Layer and Sub layer,
4.) after composing the SubItemCode, populate other INItemXRef fields like AlternativeID in which we generate from another class, and select the AlternateType of 'BAR'
5.) and other codes like validating if it already exist or not yet before continuing to generate the AlternateID.
but the problem is from 1 to 3:
Acumatica uses IDs for SubItem in INItemXRef.
Its parent table is INSubItem where "SubItemCD" and "SubItemID" are stored. "SubItemCD" is the product of the concatenated Cost Layer and Sub Layer. you store or insert these SubItemCDs first by manual f3 selection (both Cost layer and sub layer) in Stock Item's Cross Reference Tab, then only the SubItemID are inserted by acumatica.
these hinders me in coding on how to automate generating and inserting multiple InventoryItem-Subitem Barcodes for each Inventory Item. and other functions like check if that InventoryItem-SubItem combination already exists before proceeding.
What is the proper acumatica way in doing the said objective? or what strategy or tip could you help me in reaching our objective? thank you.