How to access to a parent document data in a widget


I currently make a table layout to display some search results.
But in this results, I want to display metadata which can be find in a parent document of the one which is displayed. How, in a widget, I can access to this data?
I saw that it is possible to use a EL expression in a widget layout editor but i didn't find the good one.
I managed to get the parent document Ref with this : #{document.getData().getParentRef().reference()} but I can't go further.

Somebody can help me?


0 votes

2 answers




Note that this won't handle the case where user does not have enough rights to access the parent. And as you're in a result layout, there's a good chance that this is bad for perfs.

An alternative (and more efficient) way of doing this would be to retrieve the property on the parent, and update it on the document, whenever it is created/moved.

0 votes

Ok, I find the good expression :

" #{
} " 

But it isn't very friendly. Maybe someone knows something more easy?

0 votes

How did you get it to work? On my side, It shows me a list of dc metadata (ie Nature
Source …)

Use a generic widget set his type to "text", Add a custom property in the widget editor, id : 'value' ,and for the value : the script

Maybe the first parenthesis is useless, i think you can delete it (with a parenthesis after getParentRef()of course)