cancel
Showing results for 
Search instead for 
Did you mean: 

scriptNode.sourceAssocs instead of assocs for targets?

hu2hugo
Champ in-the-making
Champ in-the-making
Is there a way to get the source associations of a node? assocs returns only the target association.

I found org.alfresco.repo.jscript.ScriptNode.getSourceAssocs() in the code but I don't understand how the java object is hooked to the javascript object.

Thanks,
Marc
2 REPLIES 2

kevinr
Star Contributor
Star Contributor
I assume you have a dev/labs build as getSourceAssocs was only added to the JavaScript ScriptNode API in the last month or so.  That is why it is not documented yet Smiley Happy

You want something like this

var sourceAssocs = node.sourceAssocs;

This returns a map of assoc qname to a list of nodes. Basically it works identically to the node.assocs Target Associations API that you have already used but it returns source assocs instead.

Kevin

hu2hugo
Champ in-the-making
Champ in-the-making
Thanks Kevin, source and running instance were indeed out of sync Smiley Surprisedops:. Everything is fine now.