cancel
Showing results for 
Search instead for 
Did you mean: 

NXQL query for locked documents

Terry_A
Champ on-the-rise
Champ on-the-rise

Looking for a way to query for locked documents of a particular type.

I've tried variations on this:

SELECT * FROM Document WHERE ecm:primaryType = 'DocumentType' AND ecm:lockOwner IS NOT NULL

including

SELECT * FROM Document WHERE ecm:primaryType = 'DocumentType' AND (ecm:lockOwner IS NOT NULL or ecm:lockOwner <> ' ')

To test the query syntax I am working in a pre-production environment where I know that some but not all of the documents of the desired types are locked. Regardless of how I word the query, I either get back all of the documents or none of the documents, not the desired subset.

Any suggestions or help is appreciated.

1 ACCEPTED ANSWER

Gregory_Carlin
Elite Collaborator
Elite Collaborator

Hello,

Try with ecm:isCheckedIn = 0 to find locked documents 🙂

More on https://doc.nuxeo.com/nxdoc/nxql/#special-nxql-properties

Regards

View answer in original post

6 REPLIES 6

Gregory_Carlin
Elite Collaborator
Elite Collaborator

Hello,

Try with ecm:isCheckedIn = 0 to find locked documents 🙂

More on https://doc.nuxeo.com/nxdoc/nxql/#special-nxql-properties

Regards

Phil_Ludlow
Star Contributor
Star Contributor

I tried your query and the first option worked correctly for me:

SELECT * FROM Document WHERE ecm:primaryType = 'DocumentType' AND ecm:lockOwner IS NOT NULL

That query returned the 1 document I had locked of the specified doctype in the NQXL.

If I use the option for isCheckedIn then it returns all the documents of the specified doctype, not sure why but it doesn't seem to acknowledge that a locked file is checkedOut.

SELECT * FROM Document WHERE ecm:primaryType = 'DocumentType' AND ecm:isCheckedIn = 0

I tested this in my local environment which is LTS 2021 (hotfix 10). If your first query is not working, then maybe it has to do with the database you are using?

TBH I'm not sure if it was a database issue or something else, but whatever the case, some of these attributes such as ecm

opage_
Champ in-the-making
Champ in-the-making

Hi ! I've got exactly the same problem. What solution did you use ?

The second question will be : how to unlock ALL locked documents (yes ... I have to do this because another software has locked many of them ...)

Getting started

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.