How to create a rule in Alfresco to move content o

2019-06-05 20:27发布

I am thinking to create a rule, possibly a javascript script, which will move documents one folder to another depending on its properties. In the other words, I will always upload documents to folderA. Alfresco will extract document's property, for example prop1, and the rule that I define will move this document to folderB if it has property prop1, otherwise it will move the document to folderC. I know how to extract properties but I don't know how to create this rule. I have no idea since I never used javascript. Any help will be appreciated.

1条回答
Anthone
2楼-- · 2019-06-05 20:55

There are some properties which you need to set while credating rule.Explanation of those properties are as below.

1.When the rules will be triggered:
- Items are created or enter this folder
- Items are update
- Items are deleted or leave this folder

2.criteria for the rule to be fired.

3.Define the action you want performed. Here you need to select custom javascript.

When you select this option it will load script from the script folder of Data Dictionary.

In that script you need to write below code.

if(document.properties.prop1=="yourvalues")
{
    document.move(folderA);//Where FolderA will be a destination node and not a string
}else{
    document.move(folderB);//Where FolderB will be a destination node and not a string

}

object document referes to current object, on which rule is executed.Refer below image.

enter image description here

Below is the script which i have tested and executed.

if(document.properties.title=="demo")
{
    document.move(companyHome);
}else{
    document.move(userhome);

}
查看更多
登录 后发表回答