I could solve it with the following:
In the view's column that generates a link I've put this code:
viewScope.UNID = rowentry.getDocument().getUniversalID();
return(false);
and set it to make a partial refresh of the Panel
Then, in the document data source definition, the document id is simply:
viewScope.UNID