I have a similar situation to this thread:
Select statment not returning data even the data exists
I have code on a button that calls the packing slip function with a WMSShipment record. Then the next few lines check that custPackingSlipTrans records exists.
Periodically we notice that this check does not find any custPackingSlipTrans records , even though they are coming out on the packing slip. As a result I have another button that does the exact same check, for the same WMSShipment record, which does return custPackingSlipTrans records.
It’s hard to identify from this description; we would need much more information.
Maybe you run the pieces in parallel threads and the record isn’t created yet. Another explanation could be caching. Or there may be any other bug…
Thanks for the reply, Here is the pseudo code :
Identical buttons, just one calls the packing slip logic.
Clicked (button 1)
new MenuFunction(menuitemActionStr(SalesFormLetter_PackingSlip), MenuItemType::Action).run(args);
So after clicking button 1, we generate a packing slip, and the custPackingSlipTrans check returns false. We then click button 2 which has the identical custPackingSlipExists check and uses the same parameters as button 1.
Clicked (button 2)
The check returns true. The custPackingSlipTrans table cache is NotInTTS, however this code is not inside a transaction. This happens intermittently.
How do you fill the value of custPackingSlipExists? Could you add it to your code snippet?
Can you check what execution mode is used? The default is ReliableAsynchronous, therefore the posting will run independently on your code. You would have to use Synchronous execution mode to make sure that your check executes only after posting is finished.
Yes the execution mode is ReliableAsynchronous.
The menu function is already being called with parameters:
So changing this to is is not going to work:
Ill figure out another way to change the execution mode, without having to much of an impact. Thank you again.