Alfresco - 在自定义工作流程中将任务分配给不同的受让人

Alfresco - assigning tasks to different assignees in custom workflow

我正在尝试创建一个自定义工作流,在工作流开始时,工作流发起者可以选择 3 个用户来执行工作流中的不同任务(在本例中,作者、审阅者和批准人)。

为此,我将这些角色中的每一个定义为我的工作流模型中开始任务的一个方面,然后我试图将这些用户分配给工作流中的过程变量,并通过activiti:assignee 任务。在我的 share-config-custom 中,我将角色定义为权限控制。我正在遵循以下描述的过程:

工作流程启动没有问题,Alfresco 允许我 select 用户,但任务分配不起作用。在工作流历史记录中,它表示任务分配给“$(author.properties.userName)”,这是我在 bpmn 文件中使用的表达式,但它没有获取作者变量的用户名。

我在下面附上了指向我的文件的链接。如果他们有什么问题,或者有更好的实现这个目标的方法,请告诉我!

非常感谢

马库斯

bpmn 文件:https://drive.google.com/file/d/0By5ruty8M4IleWlKSmdQNUNXR0k/view?usp=sharing

工作流模型文件:https://drive.google.com/file/d/0By5ruty8M4IlVEFlSWo2SElNNUE/view?usp=sharing

我会post评论里的share-config-custom

execution.setVariable('author', task.getVariable('vorwf_author'));

您正在设置一个变量 author 并且 您正在尝试使用 $(author.properties.userName)

将任务分配给作者

此处 author 不是对象,因此您找不到用户名。如果你想这样做,你必须创建用户对象

示例:输入您的用户名

 var author=people.getPerson("user_name");
 var authVar=author.properties.userName;

设置变量

execution.setVariable('my_author',authVar);

您可以使用 ${my_author}

访问它

或者

如果您通过此 task.getVariable('vorwf_author')

获取作者的用户名
 execution.setVariable('author', task.getVariable('vorwf_author'));

那么你可以简单地使用 ${author}

我已经想出办法了!首先,我将工作流中的每个 'role' 定义为我的 workflowModel.xml 文件中的一个方面。这是其中一个角色的示例,作者:

<aspects>
    <aspect name="vorwf:author">
        <associations>
            <association name="vorwf:author">
                <source>
                    <mandatory>false</mandatory>
                    <many>false</many>
                </source>
                <target>
                    <class>cm:person</class>
                    <mandatory>true</mandatory>
                    <many>false</many>
                </target>
            </association>  
        </associations>
    </aspect>

然后我在定义用户角色的任务定义中将这些角色设置为强制性方面:

 <type name="vorwf:allocateDocumentProperties">
        <parent>bpm:startTask</parent>
        <properties>
            <property name="vorwf:approveRejectOutcome">
                <type>d:text</type>
                <default>Reject</default>
                <constraints>
                    <constraint type="LIST">
                        <parameter name="allowedValues">
                            <list>
                                <value>Approve</value>
                                <value>Reject</value>
                            </list>
                        </parameter>
                    </constraint>
                </constraints>
            </property>
        </properties>
        <mandatory-aspects>
            <aspect>vorwf:author</aspect>
            <aspect>vorwf:reviewer</aspect>
            <aspect>vorwf:approver</aspect>
        </mandatory-aspects>
    </type>

最后,我可以在我的 bpmn 文件中将任务分配给用户,而无需设置任何其他变量,例如:

<userTask id="prepareDocument" name="Prepare Document" activiti:assignee="${vorwf_author.properties.userName}" activiti:formKey="vorwf:prepareDocument">