AnsweredAssumed Answered

removeAssociation and sourceAssocs

Question asked by fixit on Nov 6, 2013
Latest reply on Nov 6, 2013 by fixit

I am currently developing webscripts using alfresco 4.2.d and javascript, and have found one strange behaviour:
On all of my webscript, the removeAssociation function removes the association on the relevant node as well as the sourceAssocs reference on the source node.
However in one of my webscript it doesn't remove the sourceAssocs reference. The weird thing is, I use the exact same code, with the same input in another of my webscript, and there it works.

Here is the model :
        <type name="delegation:content">
            <title>Porte l'ensemble des délégations que porte une personne</title>
                <property name="delegation:username">
                <association name="delegation:delegataire">
                    <title>Personne délégataire</title>
                    <description>Association vers la personne qui délègue ses contact</description>
                <association name="delegation:delegue">
                    <title>Personne déléguée</title>
                    <description>Association vers le personnes à qui on délègue les contacts</description>

The transaction is set on "required" in the descriptor of both of my webscripts.

Here is the code:
    I retrieve the "delegation" nodes linked by "delegation:delegue" to my user
    Then I remove the association
var delegationNodes = user.sourceAssocs["delegation:delegue"];
for (var i = 0 ; i < delegableNodes.length ; i++){
    var delegationNode = delegationNodes;
    delegationNode.removeAssociation(user, "delegation:delegue");

Is there any explanation to this problem ?