Data selection issues - Delayed or missing records.

Hi all,

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.

  • Are the records ‘Locked’ by the packing slip logic?

  • Is it a timing issue with records not be inserted by the time the code checks custPackingSlipTrans records exist?

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);

if (custPackingSlipExists)

{

do something;

}

}

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)

{

if (custPackingSlipExists)

{

do something;

}

}

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:

EnumTypeParameter: DocumentStatus

EnumParameter: PackingSlip

So changing this to is is not going to work:

EnumTypeParameter: SysOperationExecutionMode

EnumParameter: SysOperationExecutionMode::Synchronous

Ill figure out another way to change the execution mode, without having to much of an impact. Thank you again.