AnsweredAssumed Answered

Persisting Aspect Properties

Question asked by slothrop on Sep 11, 2007
Latest reply on Sep 21, 2007 by kevinr
In Alfresco 2.1 I am writing JavaScript that moves the contents of a space into another space.  I have an aspect defined that includes the boolean property, custom:PrimaryDocument.  I would like the user to designate one of the documents in the space as the primary document before submitting the contents of the space.  However, if there is only one document I thought I could assign it to be true in my JavaScript and proceed with processing the submission even if the user has not designated the document as the primary one.

So in my code, if there is only one document in the folder I have the following (I have discovered that when there is only one document in the space, there is also another noncontent node and space.children.length = 2 and the noncontent node is space.children[0]):

children[1].properties["custom:PrimaryDocument"] = true;

Later in the code I test this:

child = children[1];
if(["custom:PrimaryDocument"]) "do something";

The test evaluates to true and the code executes but when I move the document to the new space, the property is still false.  How can I make this assignment persist?