RE: "Lot ID Not Specified" Error when Invoicing a Return
I don't know much about ReturnInventTransOrigin either and honestly had trouble finding a good description of it online. At first I was concerned that the RecId I suspected was associated with that field but then several of the records leading up to this one did have InventTransOrigin and ReturnInventTransOrigin set to the same value.
Basically, the record causing the problem was a production order. Still not entirely sure why it's causing issues with our invoicing of returns. But I went to InventTransOriginProdTable and looked for the production order in question. It did not exist on this table, there was gap in the Production Order Id numbering AND in the RecId numbering where this record should have been. So I figured a new record needed to be constructed there, the record on InventTransOrigin seemed to already exist, and the record on InventTrans existed just with InventTransOrigin set to 0.
I copied our LIVE environment to our TEST environment to comfortably test this theory out. It seemingly fixed the issue and I tested sales orders, production orders, purchase orders etc. to check if I inadvertently messed something else up. Everything still seems okay so that's exciting!
Going to do a little bit more testing of typical workflows to make sure nothing's gone awry but I do believe this is the solution. Let me know if anything I did here raises a red flag for things to go wrong. I can't think of anything.