问题描述
我正在考虑创建一个规则,可能是一个javascript脚本,它会根据文件的属性将文档移动到另一个文件夹。换句话说,我将始终将文档上传到 folderA
。 Alfresco将提取文档的属性,例如 prop1
,我定义的规则将此文档移动到 folderB
如果它具有属性 prop1
,否则它将文档移动到 folderC
。我知道如何提取属性,但我不知道如何创建此规则。我不知道,因为我从未使用过javascript。任何帮助将不胜感激。
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.
推荐答案
在记下规则时,您需要设置一些属性。这些属性的说明如下。
There are some properties which you need to set while credating rule.Explanation of those properties are as below.
1.当触发规则时:
- 项目已创建或输入此文件夹
- 项目已更新
- 项目被删除或保留此文件夹
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,用于触发规则。
2.criteria for the rule to be fired.
3.定义要执行的操作。
在这里你需要选择自定义的javascript。
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);
}
这篇关于如何在Alfresco中创建规则以将内容一个文件夹移动到另一个文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!