AnsweredAssumed Answered

Obtaining comment information within a Workflow.

Question asked by tchenm1 on Feb 26, 2013
I have an "Activiti" workflow and at the end of an user task I am trying to read the comment field and save it to my content model type custom field. I implemented a listener (Alfresco script type) to the user task and am trying to read the comment field. I have read multiple forum articles about how this is done, but have not figured it out yet.

The below is what I have, please help point me the right direction.

var workflow = workflow.assignedTasks;
var comment = task.getVariable(workflow.id, 'bpm_comment');
parentFolder.properties["sop:sourceSubComment"] = comments.get(0).message;

Thanks!

Mike T

Update:

Apparently I do not need to pass the workflow ID as an argument. The below was all I needed to pass a workflow comment field to my content model type custom field:

var document = bpm_package.children[0];
var parentFolder = document.parentAssocs["cm:contains"][0];
var person = people.getPerson('Bautista');
parentFolder.properties["sop:sourceSubmitted"] = new Date();
parentFolder.save();
parentFolder.properties["sop:sourceSubComment"] = task.getVariable("bpm_comment");
parentFolder.save();
parentFolder.createAssociation(person, "sop:sourceSubPerson");
parentFolder.save();

Outcomes