Check if a table is locked

Hi All,

I have this codeunit (run from the job queue) that fetches some *.csv files from a network share and posts the data it gathers on the Job Journal Line.

But sometimes the posting is stoped because the table is locked and the job queue task blocks.

Is there anyway of checking if a table is locked before starting any insert operation?

And if so, could you give me a hint on how to deal with this issue without losing the data I gathered?

Thank you in advance.

Best Regards,

ZPaulo.

Have tried the

Record.LOCKTABLE([Wait] [, VersionCheck])

code?

Thanks for your reply.

Honestly, I haven’t because I was wondering if there is a way of doing something like:

IF table_is_locked THEN
skip_posting
ELSE
insert_record