//esto es del bpmModel.xml
<mandatory-aspects>
<aspect>cmwnable</aspect>
</mandatory-aspects>
//y esto es del contentModel.xml
<aspect name="cmwnable">
<title>Ownable</title>
<properties>
<property name="cmwner">
<title>Owner</title>
<type>d:text</type>
</property>
</properties>
</aspect>
<?xml version="1.0" encoding="UTF-8"?>
<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="wf:reviewpooled">
<swimlane name="initiator" />
<start-state name="start">
<task name="wf:submitGroupReviewTask" swimlane="initiator" />
<transition name="" to="review" />
</start-state>
<swimlane name="reviewer">
<assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
<pooledactors>#{bpm_groupAssignee}</pooledactors>
</assignment>
</swimlane>
<task-node name="review">
<task name="wf:reviewTask" swimlane="reviewer">
<event type="task-create">
<script>
if (bpm_workflowDueDate != void) taskInstance.dueDate = bpm_workflowDueDate;
if (bpm_workflowPriority != void) taskInstance.priority = bpm_workflowPriority;
</script>
</event>
<event type="task-end">
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
<variable name="bpm_assignee" access="write"/>
<expression>
if (taskInstance.actorId != null)
people.getPerson(taskInstance.actorId);
else
person;
</expression>
</script>
</action>
</event>
</task>
<transition name="" to="completed" />
<event type="node-enter">
<!– Update the status to Rejected when we enter this task –>
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
for (var i = 0; i < bpm_package.children.length; i++)
{
bpm_package.children.properties["myrioridad"] = bpm_workflowPriority;
bpm_package.children.properties["my:estado"] = "Pendiente";
//con esta linea obtengo el grupo, pero en que momento podria obtener el usuario?
bpm_package.children.properties["my:tecnico"] = bpm_groupAssignee.properties["usr:authorityName"];
bpm_package.children.save();
}
</script>
</action>
</event>
</task-node>
<task-node name="completed">
<event type="node-enter">
<!– Update the status to Aproved when we enter this task –>
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
for (var a = 0; a < bpm_package.children.length; a++)
{
bpm_package.children[a].properties["myrioridad"] = bpm_workflowPriority;
bpm_package.children[a].properties["my:estado"] = "Acabado";
bpm_package.children[a].properties["my:tecnico"] = bpm_ownable; //esto no trae nada y esto tampoco bpm_package.properties["cmwner"];
bpm_package.children[a].save();
}
</script>
</action>
</event>
<transition name="" to="end" />
</task-node>
<end-state name="end" />
</process-definition>
Por ello pienso que para acceder a las propiedades del modelo content a partir de la tarea, bastaria con realizar una busqueda sobre la propiedad deseada en el modelo content a partir de la instancia de la tarea en cuestion.
<?xml version="1.0" encoding="UTF-8"?>
<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="wf:reviewpooled">
<swimlane name="initiator" />
<start-state name="start">
<task name="wf:submitGroupReviewTask" swimlane="initiator" />
<transition name="" to="review" />
</start-state>
<swimlane name="reviewer">
<assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
<pooledactors>#{bpm_groupAssignee}</pooledactors>
</assignment>
</swimlane>
<task-node name="review">
<task name="wf:reviewTask" swimlane="reviewer">
<event type="task-create">
<script>
if (bpm_workflowDueDate != void) taskInstance.dueDate = bpm_workflowDueDate;
if (bpm_workflowPriority != void) taskInstance.priority = bpm_workflowPriority;
</script>
</event>
<event type="task-end">
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
<variable name="bpm_assignee" access="write"/>
<expression>
if (taskInstance.actorId != null)
people.getPerson(taskInstance.actorId);
else
person;
</expression>
</script>
</action>
</event>
</task>
<transition name="" to="completed" />
<event type="node-enter">
<!– Update the status to Rejected when we enter this task –>
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
for (var i = 0; i < bpm_package.children.length; i++)
{
bpm_package.children[i].properties["my:prioridad"] = bpm_workflowPriority;
bpm_package.children[i].properties["my:estado"] = "Pendent";
bpm_package.children[i].properties["my:tecnico"] = bpm_groupAssignee.properties["usr:authorityName"];
bpm_package.children[i].save();
}
</script>
</action>
</event>
</task-node>
<task-node name="completed">
<event type="node-enter">
<!– Update the status to Aproved when we enter this task –>
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
for (var a = 0; a < bpm_package.children.length; a++)
{
bpm_package.children[a].properties["my:prioridad"] = bpm_workflowPriority;
bpm_package.children[a].properties["my:estado"] = "Acabat";
bpm_package.children[a].properties["my:tecnico"] = search.luceneSearch("@cm\\:userName:\"" + taskInstance.actorId + "\"");
bpm_package.children[a].save();
}
</script>
</action>
</event>
<transition name="" to="end" />
</task-node>
<end-state name="end" />
</process-definition>
Content from pre 2016 and from language groups that have been closed.
Content is read-only.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.