Workflow comments on document comments

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2014 04:29 AM
Hello,
I'm using a workflow to validate documents. When users approve or reject a document, they can comment it. I would like to get this comment and put then in the comment of the document.
I supposed i can get workflow comments with the [bpm:comment] property but i don't know how i can create a comment in a document, using Javascript.
Waiting for your help.
Thanks
I'm using a workflow to validate documents. When users approve or reject a document, they can comment it. I would like to get this comment and put then in the comment of the document.
I supposed i can get workflow comments with the [bpm:comment] property but i don't know how i can create a comment in a document, using Javascript.
Waiting for your help.
Thanks

Labels:
- Labels:
-
Archive
4 REPLIES 4
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2014 05:32 AM
I am assuming that you have some custom property on document for storing comment.
Using javascript api you can easily achieve that.
Please refer the link http://wiki.alfresco.com/wiki/4.0_JavaScript_API and section "Modifying and Creating API".
It may help to you.
Using javascript api you can easily achieve that.
Please refer the link http://wiki.alfresco.com/wiki/4.0_JavaScript_API and section "Modifying and Creating API".
It may help to you.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2014 04:35 AM
Hum not really yogeshPJ
In fact I want to retrieve the task comments to put it in the Document comment (in Alfresco Share). However, i saw that we can't get back task comments in workflow context (related this <a href="http://forums.alfresco.com/forum/developer-discussions/workflow/problems-accessing-bpmcomment-variab...">post</a> ).
I updated my workflow file definition (parallel-review.bpmn20.xml) .I know how to create comment on document using JS but for the moment, I'm just trying to put the comment in the document description.
and this
But it still not working. Someone could help me please ? Thanks a lot.
In fact I want to retrieve the task comments to put it in the Document comment (in Alfresco Share). However, i saw that we can't get back task comments in workflow context (related this <a href="http://forums.alfresco.com/forum/developer-discussions/workflow/problems-accessing-bpmcomment-variab...">post</a> ).
I updated my workflow file definition (parallel-review.bpmn20.xml) .I know how to create comment on document using JS but for the moment, I'm just trying to put the comment in the document description.
var taskId = "activiti$" + task.getId();bpm_package.children[j].properties['cm:description']+= workflow.getTask(taskId).getProperties()["bpm:comment"];
and this
<expression> comment = ""; if (token.comments.size() > 0) comment = token.comments.get(0).message; </expression> <variable name="comment" access="write"/> bpm_package.children[j].properties['cm:description'] = comment; bpm_package.children[j].save();
But it still not working. Someone could help me please ? Thanks a lot.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2014 06:20 AM
It seems that comment value is not assigned properly.
can you please try below code ?
<expression>
comment = "";
if (token.comments.size() > 0)
comment = token.comments.get(0).message;
</expression>
<variable name="comment" access="write"/>
var doc= bpm_package.children[j];
doc.properties['cm:description'] = comment;
doc.save();
can you please try below code ?
<expression>
comment = "";
if (token.comments.size() > 0)
comment = token.comments.get(0).message;
</expression>
<variable name="comment" access="write"/>
var doc= bpm_package.children[j];
doc.properties['cm:description'] = comment;
doc.save();

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2014 11:51 AM
I tried with your example but still not working. I had the following error message :
org.activiti.engine.ActivitiException: Exception while invoking TaskListener: Exception while invoking TaskListener: 05110042 Failed to execute supplied script: 05110041 ReferenceError: "token" n'est pas défini (AlfrescoJS#36)
My approve task looks like this :
Any ideas ??
org.activiti.engine.ActivitiException: Exception while invoking TaskListener: Exception while invoking TaskListener: 05110042 Failed to execute supplied script: 05110041 ReferenceError: "token" n'est pas défini (AlfrescoJS#36)
My approve task looks like this :
<userTask id="approved" name="Document Approved" activiti:formKey="wf:approvedParallelTask" > <documentation> The document was reviewed and approved. </documentation> <extensionElements> <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener"> <activiti:field name="script"> <activiti:string> if (typeof bpm_workflowDueDate != 'undefined') task.dueDate = bpm_workflowDueDate if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority; // Set parallel review params on task, to be kept in history task.setVariableLocal('wf_reviewerCount', wf_reviewerCount); task.setVariableLocal('wf_requiredPercent', wf_requiredPercent); task.setVariableLocal('wf_actualPercent', wf_actualPercent); task.setVariableLocal('wf_approveCount', wf_approveCount); for(var j=0; j<bpm_package.children.length; j++) { if(bpm_package.children[j].properties['cm:description'] == "EN COURS D'APPROBATION") { if(wf_actualPercent == 100) { bpm_package.children[j].properties['cm:description'] = "APPLICABLE"; bpm_package.children[j].save(); var doc = bpm_package.children[j]; doc.addAspect("cm:versionable"); var tmp = doc.checkout(); doc = tmp.checkin("Document applicable",true); bpm_package.children[j] = doc } } else { if(wf_actualPercent == 100) { bpm_package.children[j].properties['cm:description'] = "EN COURS D'APPROBATION"; bpm_package.children[j].save(); } } var comment = ""; if (token.comments.size() > 0) comment = token.comments.get(0).message; var doc= bpm_package.children[j]; doc.properties['cm:description'] = comment; doc.save(); } </activiti:string> </activiti:field> </activiti:taskListener> </extensionElements>
Any ideas ??
