cancel
Showing results for 
Search instead for 
Did you mean: 

How to move document to Space based on Aspect Property JS

sanku_alfresco
Champ in-the-making
Champ in-the-making
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
2 REPLIES 2

sanku_alfresco
Champ in-the-making
Champ in-the-making
hi,
  I moved the document to space using following js


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

var testingFolder = userhome.childByNamePath("User Homes/Finance/Deposit/"+cats);



if(userhome.childByNamePath("User Homes/Finance/Deposit/"+cats))
{
document.move(testingFolder);


}




    var goBack = "<script>history.back();</script>";
    goBack;

gnpc
Champ in-the-making
Champ in-the-making
When, or from where, do you call this script?

Thanks