How to create a rule in Alfresco to move content one folder to another?

时光怂恿深爱的人放手 提交于 2019-12-08 04:45:01

问题


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:


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.

Below is the script which i have tested and executed.

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

}


来源:https://stackoverflow.com/questions/29954568/how-to-create-a-rule-in-alfresco-to-move-content-one-folder-to-another

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!