cancel
Showing results for 
Search instead for 
Did you mean: 

behavior to set association name

darionis
Champ on-the-rise
Champ on-the-rise
Hello,

I generate node name dynamically, using OnCreateNode bahavior to calculate node name before saving it. I would also like to use the same generated name as association name (it is a common "contains" association, I just want to have descriptive name).

Usually, association name is set using nodeService.createNode(…) 'assocQname' parameter. Is it possible to set assoc name using behavior?

OnCreateNodePolicy and OnCreateChildAssociationPolicy use ChildAssociationRef parameter but it does not allow to set assocQName.

Any suggestions, please?

Thanks!
2 REPLIES 2

angelborroy
Community Manager Community Manager
Community Manager
You should try to move the node below the same parent using the new assoc name.

<CODE>
nodeService.setProperty(nodeRef, ContentModel.PROP_NAME, newName);</CODE>

<CODE>
nodeService.moveNode(nodeRef, parentRef, ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, newName));

</CODE>
Hyland Developer Evangelist

Great, it works!

Thanks, Angel!