In Alfresco content Modeling Article we have seen how to create custom content Model in Alfresco. In content types for relating multiple contents from same repository associations are used. In previous post about association I have explained the role of Association in Alfresco how they are using in alfresco and how can we create new association in custom content type.

Some of the times we have a requirement where we want to remove particular association from a single content or set of contents or may be from full repository.

Assume you want to carry out this operation in production system without any downtime best way to achieve this is through alfresco javascript. For more details on alfresco java script you can refer this previous blog on alfresco javascript.

So, in short we need to create script file according to our requirement, upload it under alfresco>Data Dictionary>Script and then associate that with rule and apply that rule to all contents on which association operation needs to be carried out.

We will be using node object’s apis to achieve this.

So let us take a look at the multiple scenarios

Delete specific association from content

for each (targetNode in document.assocs[« custom:myassociation »])


document.removeAssociation(targetNode, ” custom:myassociation “);



NOTE: It is always advisable to save content node after doing modification on node to ensure that transaction is committed properly. Sometimes you are likely to lose your changes if you do not use save method in the end of your script.

In this case “custom:myassociation” is the name of association which we want to remove from particular node or all set of contents.

For applying this script on set of contents create rule on top of folder under which all contents are lying and attach this script with rule and apply that rule to all existing contents. For more details on how to apply rule on existing contents refer this blog.

Further Reading:


Looking for quality Alfresco Web Hosting ? Look no further than Arvixe Web Hosting !


Laisser un commentaire

Choisissez une méthode de connexion pour poster votre commentaire:

Logo WordPress.com

Vous commentez à l'aide de votre compte WordPress.com. Déconnexion /  Changer )

Photo Google+

Vous commentez à l'aide de votre compte Google+. Déconnexion /  Changer )

Image Twitter

Vous commentez à l'aide de votre compte Twitter. Déconnexion /  Changer )

Photo Facebook

Vous commentez à l'aide de votre compte Facebook. Déconnexion /  Changer )


Connexion à %s