Howdy! I've got an issue scripting the Inventory D...
# general
l
Howdy! I've got an issue scripting the Inventory Detail on Item Fulfillment Lines. When fulfilling from the Sales Order, the Inventory Detail is automatically filled out for lines where the SO line has a Work Order. The UI shows the green checkbox for those lines. The problem I'm having is that, in the client script pageInit(), curRec.hasCurrentSublistSubrecord() is only returning true for lines whose item is lot numbered. One of my test lines is not a lot numbered item, and although the inventory detail is a green check, hasCurrentSublistSubrecord() is false for that line, and I get errors with any function trying to go further into that data. If I click to enter the Inventory Detail UI, then click OK to accept what it's already got there, then try to save, in the saveRecord() hook, hasCurrentSublistSubrecord() returns true for that line and I can access the data. If I save the new Item Fulfillment without entering the Inventory Detail UI for that line, saveRecord() does not see the Inventory Detail data for that line, though it's there on the next screen after it's been saved...
b
the current record in client suitescript offers no way to set subrecords lines in inventory details
you can tell if the inventory detail exists or not using hasCurrentSublistSubrecord, but that wont help you set their values
expect to look for an alternative way to implement whatever you are trying to do
l
Yeah, the documentation states that you can't modify subrecords in that context (I still tried lol), so I'm just trying to detect the current state and then warn where appropriate. I've got my scenario set up so that the Item Fulfillment create screen has two lot numbered items and one non-lot item, and all three lines have a default Inventory Detail set. All three come up with the wrong bin selected by default, so I want to display a message to the user to fix the bins. In the client script, the two lot numbered items hasCurrentSublistSubrecord === true, but for the non lot controlled hasCurrentSublistSubrecord === false. saveRecord(), without making any changes to the record, gets the same results. If I click the green check to open the Inventory Detail for the offending line, then click OK without making changes, then saveRecord() then gets hasCurrentSublistSubrecord === true for the line. So somehow the UI and the API aren't agreeing on the initial creation screen. When editing the record later, everything works as expected, but we're past the process step where we want the user to avoid their problem.
b
hasCurrentSublistSubrecord is used to detect when the subrecord exists
it provides no information about whether all quantity has been assigned
l
I'm not trying to find out if all quantity has been assigned. I want to find out what bin has been selected by default. The problem is that the UI says there is an Inventory Detail for the line, but the API says there isn't. So the user can save the record with the wrong Bin selected by default and I can't detect it.