Web scripts and Workflows

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2009 03:20 AM
Hello,
I'm trying to modify the following web script a little bit to be able to also add a comment when a task is ended:
org/alfresco/repository/workflow/end-task.post.js:
The row that I have added is task.properties["bpm:comment"] = "test" just to see if I can add a comment. But the comment is not set and not displayed in the Workflow history. What am I doing wrong?
I'm trying to modify the following web script a little bit to be able to also add a comment when a task is ended:
org/alfresco/repository/workflow/end-task.post.js:
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; } task.properties["bpm:comment"] = "test" model.transitionId = transitionId; task.endTask(transitionId);}main();
The row that I have added is task.properties["bpm:comment"] = "test" just to see if I can add a comment. But the comment is not set and not displayed in the Workflow history. What am I doing wrong?
Labels:
- Labels:
-
Archive
4 REPLIES 4

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2009 04:03 AM
Clarification: I'm using the built in Review & Approve workflow.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2009 04:30 AM

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2009 05:22 AM
I think "===" is correct because the code works fine except for setting the comment. Here is a description for "===" in Javascript: http://javascript.about.com/library/blequals.htm
The problem is that my Javascript is not embedded in a Workflow. It is a web script interacting with a running workflow so I cannot do exactly the same thing that is possible when using Javascript directly within the workflow.
The problem is that my Javascript is not embedded in a Workflow. It is a web script interacting with a running workflow so I cannot do exactly the same thing that is possible when using Javascript directly within the workflow.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2009 07:21 AM
Nobody know how to do this?
