05-06-2014 04:29 AM
<?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="approve" to="approved">
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<runas>admin</runas>
<script>
var dest = companyhome.childByNamePath("Site/test-script/documentLibrary/kepada");
bpm_context.move(dest);
</script>
</action>
</transition>
<transition name="reject" to="rejected"/>
</task-node>
<task-node name="rejected">
<task name="wf:rejectedTask" swimlane="initiator" />
<transition name="" to="end" />
</task-node>
<task-node name="approved">
<task name="wf:approvedTask" swimlane="initiator" />
<transition name="" to="end"/>
</task-node>
<end-state name="end" />
</process-definition>
function startWorkflow(assigneeGroup)
{
var workflow = actions.create("start-workflow");
workflow.parameters.workflowName = "activiti$activitiReviewPooled";
workflow.parameters["bpm:workflowDescription"] = "Please review " + document.name;
workflow.parameters["bpm:groupAssignee"] = assigneeGroup;
var futureDate = new Date();
futureDate.setDate(futureDate.getDate() + 3);
workflow.parameters["bpm:workflowDueDate"] = futureDate;
return workflow.execute(document);
}
function main()
{
var name = document.name;
var siteName = document.siteShortName;
if (siteName == null)
{
if (logger.isLoggingEnabled())
logger.log("Did not start workflow as the document named " + name + " is not located within a site.");
return;
}
var reviewGroup = "GROUP_URUSETIA SEKRETARIAT";
// make sure the group exists
var group = people.getGroup(reviewGroup);
if (group != null)
{
if (logger.isLoggingEnabled())
logger.log("Starting pooled review and approve workflow for document named " + name + " assigned to group " + reviewGroup);
startWorkflow(group);
if (logger.isLoggingEnabled())
logger.log("Started pooled review and approve workflow for document named " + name + " assigned to group " + reviewGroup);
}
else if (logger.isLoggingEnabled())
{
logger.log("Did not start workflow as the group " + reviewGroup + " could not be found.");
}
}
main();
05-06-2014 09:24 AM
05-06-2014 03:15 PM
05-07-2014 11:22 AM
logger.log("****");//valide if your javascript is entered as expected
var dest = companyhome.childByNamePath("Site/test-script/documentLibrary/kepada");
logger.log(dest);// make sure your destination node exists
logger.log(bpm_package.children[0]);//check your node to move.
bpm_package.children[0].move(dest);
05-07-2014 04:14 PM
05-08-2014 01:38 AM
logger.getSystem().out("*****");
12-10-2015 05:17 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.