Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Supply chain | Supply Chain Management, Commerce
Unanswered

Unable to select a record again after selecting it once

(0) ShareShare
ReportReport
Posted on by
While performing a warehouse mobile device operation, a record in WorkTable for a WorkId ending with 001034 gets selected in a standard class as shown below:
 
 
Due to a change request in one of the warehouse processes, I have created some code extensions as a result of which this method gets called up again during the same execution cycle for the same WorkId ending with 001034. But unexpectedly, it doesn't select the record this time as shown below:
 
 
From what I understood, it is happening because of the combination of readPast method & pessimisticLock @ line 314 & 316 respectively. Somehow, the select happening the 1st time locks the record for selection & therefore when accessing it again the 2nd time, it doesn't get selected even though it should as there are all sort of statements (Committing transaction & closing the connection) written in the end of this method to release any possible locks after 1st select:
 
 
I have tried using concurrencyModel table method on WorkTable with different parameter values but that also didn't help to release the lock applied during 1st select & make it available to be used the 2nd time.
 
Is there any definitive way to release a lock from a record?
  • Martin Dráb Profile Picture
    Most Valuable Professional on at
    Unable to select a record again after selecting it once
    I also think it's caused by a lock and readPast().
     
    A lock gets released when the transaction ends, either because it's committed or aborted. But it may be locked by something else than you think; look into the database for details.
     
    Changing ConcurrencyModel on the table will have no effect, because the query explicitly uses pessimistic locking.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans