AnsweredAssumed Answered

How to move document to Space based on  Aspect Property JS

Question asked by sanku.alfresco on Dec 5, 2008
Latest reply on Mar 26, 2010 by gnpc
Hi,
I am newbie to Alfresco..

I am having Approve Space under Finance Space(User Homes/Finance/Approve)..Under this I am having two Folders Namely Deposit and Loan..
And under Deposit space i am having sub spaces like Account_1,Account_2,Account_3.

User Homes/Finance/Approve
                                |_ Deposit——>Account_1,Account_2,Account_3
                                |_ Loan———>Account_1,Account_2,Account_3

In Approve Space it contains so many documents..

I have to enter Account Id (I added as Aspect property) in every document..

And based on the account id i entered I have to move the document to
EITHER Deposit.Alfresco1 Space OR Loan.Alfresco1 Space based on the Aspect property value …

For ex..If i entered Account-1 as aspect property means the document should be moved to Account-1 folder


I used the following script

movetospace.js

var cats = document.properties["custom:Account ID"];

var targetfolder =userhome.childByNamePath(cats);

if ((cats != null))
    {
   
      var copy = document.move(cats);



    }

  




i able to retrieve the aspect value by the below statement

var cats = document.properties["custom:Account ID"];

But cant  move the document to user space..
I tried with following statements..Its not working.

var targetfolder =userhome.childByNamePath(cats);


if ((cats != null))
    {
   
      var copy = document.move(cats);



    }

  



Any Help

Outcomes