Skip to main content
Kofax

How to prevent folder/document lock errors when using TakeNextActivity API

Problem:

A use case exists of users taking capture activities using the TakeNextActivity SDK and not via a workqueue.   In this use case, if for some reason the folder/document was locked in the capture form, they would be redirected and an error would occur due to the folder/document in the locked status.

Solution

If you want to guarantee users will not take capture activities with already locked folders, you could call GetJobVariableLockStatus and if so ForceUnlockItem.

For example, you could add actions within the TakeNextActivity button to call the following API's:

  1. To check if the folder is locked: CaptureDocumentService GetJobVariableLockStatus
  2. A condition to check if the GetJobVariableLockStatus call returned a status = 2 (locked),
  3. If so, to perform CaptureDocumentService.ForceUnlockItem before redirecting to the validation activity.

 Note: typically we do not recommand using ForceUnlockItem as it could remove valid locks, however, in this use case which only returns capture activities it should be fine. This is only one example, you may use a different approach depending on your specific use case.

 As always, we recommand testing on a consistent lower system to verify it is working as you expect.

  • Was this article helpful?