09-08-2010 04:57 AM
<?xml version="1.0" encoding="UTF-8"?>
<process-definition xmlns="urn:jbpm.org:jpdl-3.1"
name="mywf:siteReview">
<swimlane name="initiator" />
<start-state name="start">
<task name="mywf:submitSiteReviewTask" swimlane="initiator">
</task>
<transition name="" to="review" />
</start-state>
<task-node name="review">
<task name="mywf:reviewMyTask">
<assignment class="com.company.repo.workflow.GroupAssignment">
<actors>#{mywf_approvalUser}</actors>
<pooledactors>SuperAdmin</pooledactors>
</assignment>
<event type="pool-assign">
<script>
if (bpm_workflowDueDate != void) taskInstance.dueDate =
bpm_workflowDueDate;
if (bpm_workflowPriority != void)
taskInstance.priority =
bpm_workflowPriority;
</script>
</event>
</task>
<transition name="ApproveSite" to="approved" />
<transition name="RejectSite" to="rejected" >
</transition>
</task-node>
<task-node name="rejected">
<event type="node-enter">
<action class="com.company.repo.workflow.MyWorkflowAction">
<status>rejected</status>
</action>
</event>
<task name="mywf:rejectedTask" swimlane="reviewer">
</task>
<transition name="" to="end" />
</task-node>
<task-node name="approved">
<event type="node-enter">
<action class="com.company.repo.workflow.MyWorkflowAction">
<status>approved</status>
</action>
</event>
<transition name="" to="end" />
</task-node>
<end-state name="end" />
</process-definition>
I have my custom method inside /share/components/dashlets/my-tasks-min.js
doActionOnOkClick: function MyTasks_doActionOnOkClick(taskId, transitionId,rejectComment)
{
// Set this taskId to true so we don't send multiple calls for the same task
this.activeTaskTransitions[taskId] = true;
var url = YAHOO.lang.substitute("api/workflow/task/end/{taskId}/{transitionId}/{rejectComment}",
{
taskId: taskId,
transitionId: transitionId,
rejectComment: rejectComment
});
// Transition the task
Alfresco.util.Ajax.request(
{
url: Alfresco.constants.PROXY_URI + url,
method: "post",
successCallback:
{
fn: function()
{
this.onTaskTransitionSuccess();
},
scope: this
},
successMessage: this._msg("transition.success"),
failureCallback:
{
fn: function()
{
this.activeTaskTransitions[taskId] = false
},
scope: this
},
failureMessage: this._msg("transition.failure"),
scope: this
});
},
function main()
{
// Task ID
var taskId = url.templateArgs.taskId;
if (taskId === undefined)
{
status.setCode(status.STATUS_BAD_REQUEST, "TaskID missing when ending task.");
return;
}
// Check TaskId is valid
var task = workflow.getTask(taskId);
if (task === null)
{
status.setCode(status.STATUS_BAD_REQUEST, "Invalid TaskID when ending task.");
return;
}
model.taskId = taskId;
// Optional Transition ID
var transitionId = url.templateArgs.transitionId;
if (transitionId === undefined)
{
transitionId = null;
}
model.transitionId = transitionId;
// Optional comment
var rejectComment = url.templateArgs.rejectComment;
if (rejectComment === undefined)
{
rejectComment = "";
}
model.rejectComment = rejectComment;
[b]I am getting here all below 3 parameters perfectly in logger output[/b]
logger.log("******* taskID :"+ taskId);
logger.log("******* transitionId :"+ transitionId);
logger.log("******* rejectComment :"+ rejectComment);
[b]Unfortunetely from below code, I am not able to set reject comment to my workflow property… I am using alfresco 3.2r enterprise[/b]
var workflowProperties = task.getProperties();
workflowProperties["bpm:description"] = rejectComment;
task.setProperties(workflowProperties);
task.endTask(transitionId);
}
main();
10-26-2010 09:53 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.