Just spent the last 2 days looking into this. I have an API that returns a list of available serial numbers, which I needed to enter into the inventory detail on assembly builds.
Client Scripts cannot write to the inventory detail sublist, and the inventory detail subrecord gets created on submit, which should work, but is required for validation prior to record save and therefore beforeSubmit. Inventory detail is also read only on before load. You could probably script the whole process, and use suitescript to create the assembly build, but that could get complicated with all the component inventory details if they differ from the WO components sublist.
Solution I ended up with was I created a custom sublist in a before load where I pulled in the list of available serial numbers, had them select the correct ones, then in before submit, I wrote the selected serial numbers into the inventory detail sublist. Since the inventory detail subrecord hasn't been created yet, it has an id of null, but you should still be able to write to the 'inventoryassignment' sublist using inventoryDetailSubrecord.setSublistValue().
With my solution, they still have to populate the inventory detail subRecord, but after they save, it writes the correct serial Numbers. Best I could come up with on a limited timescale.
I'd be very interested if anyone has a better solution.