How to prevent folder/document lock errors when using TakeNextActivity API
Issue
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:
- To check if the folder is locked: CaptureDocumentService GetJobVariableLockStatus
- A condition to check if the GetJobVariableLockStatus call returned a status = 2 (locked),
- If so, to perform CaptureDocumentService.ForceUnlockItem before redirecting to the validation activity.
Note: typically we do not recommend using ForceUnlockItem since it could remove valid locks. However, in this use case which only returns capture activities it should be fine. This is only one example, since you may use a different approach depending on your specific use case.
As always, we recommend testing on a consistent lower system to verify it is working as you expect.
Level of Complexity
Moderate
Applies to
Product | Version | Build | Environment | Hardware |
---|---|---|---|---|
KTA | 7.x |
Article # 3045586