AnsweredAssumed Answered

Adding DataList Attachments to Workflow Package

Question asked by clperkins on May 23, 2012
Hi everyone,

   I'm struggling with the last part of my project and I need some help. What I've accomplished so far is to create both a custom datalist and workflow for our team's change management process. all of the models, forms, etc. are right where I want them. The create new datalist item form contains the cm:attachment field so that evidence, screenshots, etc. can be attached to the CMR item. The attachments show up correctly in the datagrid and view/edit forms in the datalist. I am kicking off the accompanying change management workflow via a business rule on the list that executes this script, passing in the required variables.

var person=document.assocs["dl:taskAssignee"][0];
var username=person.properties["{http://www.alfresco.org/model/content/1.0}userName"];
var workflow = actions.create("start-workflow");
workflow.parameters.workflowName = "activiti$change.management";
workflow.parameters["bpm:workflowDescription"] =  document.properties.description;
workflow.parameters["xxxcm:developer"] = people.getPerson(username);
workflow.parameters["xxxcm:requestType"] = document.properties["dl:requestType"];
workflow.parameters["bpm:workflowPriority"] = document.properties["dl:requestPriority"];
workflow.parameters["xxxcm:site"] = document.properties["dl:requestSite"];
workflow.parameters["xxxcm:requestStatus"] = document.properties["dl:requestStatus"];
workflow.parameters["bpm:workflowDueDate"] = document.properties["dl:requestDueDate"];
workflow.parameters["bpm:sendEMailNotifications"] = false;
workflow.parameters["bpm:packageItems"] = document.properties["cm:attachments"];
workflow.parameters["xxxcm:tierOne"] = people.getGroup("GROUP_ALFRESCO_ADMINISTRATORS");
workflow.parameters["xxxcm:tierTwo"] = people.getGroup("GROUP_ALFRESCO_ADMINISTRATORS");
workflow.parameters["xxxcm:qa"] = people.getGroup("GROUP_ALFRESCO_ADMINISTRATORS");
workflow.parameters["xxxcm:approval"] = people.getGroup("GROUP_ALFRESCO_ADMINISTRATORS");
workflow.parameters["xxxcm:it"] = people.getGroup("GROUP_ALFRESCO_ADMINISTRATORS");

workflow.execute(document);

The part that is not happening at the moment is:
workflow.parameters["bpm:packageItems"] = document.properties["cm:attachments"];

I'm just trying to include the datalist attachments as packageItems. The noderef of the datalist item gets passed into the package group by default, which is great because I can update properties, such as status, while routing the workflow and the changes are reflected in the datalist item.

Do I need to create some variable as with the dl:taskAssignee and reference the attachments in that manner? If so, am I using the correct workflow.parameter to add to the workflow package?

Any help is greatly appreciated!

Outcomes