cancel
Showing results for 
Search instead for 
Did you mean: 

What is the definition of a document's parent?

karl_harris_
Star Collaborator
Star Collaborator

More specifically, how do I differentiate between the immediate parent and the parent of the parent(grandparent) when using the JAVA code below?

DocumentModel x = session.getParentDocument( input.getParentRef());

where session is the injected session and input is a reference to the current document's DocumentModel.

If I look at x.getType() the type is the parent of the parent (grandparent) not the parent document.

The documents on all three levels are folders (from bottom to top a folder, in a folder, in a folder)

1 ACCEPTED ANSWER

karl_harris_
Star Collaborator
Star Collaborator

Ok, found out what I was doing incorrectly.

	parentDoc = session.getParentDocument(input.getParentRef()); 

should be

           parentDoc = session.getDocument(input.getParentRef()); 

I was getting the parent of the parent and therefore skipping over the immediate parent document.

Pilot error!!!!

View answer in original post

2 REPLIES 2

karl_harris_
Star Collaborator
Star Collaborator

Update

karl_harris_
Star Collaborator
Star Collaborator

Ok, found out what I was doing incorrectly.

	parentDoc = session.getParentDocument(input.getParentRef()); 

should be

           parentDoc = session.getDocument(input.getParentRef()); 

I was getting the parent of the parent and therefore skipping over the immediate parent document.

Pilot error!!!!

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.