Hi, I've this javascript for start a my advanced workflow, but the problem born when during the initialization when I want to add more than one document to the wf.This is the script:for (i=0;i<space.children.length;i++){
/*Lo script viene fatto partire nella cartella "Documenti Entranti", dove verranno create le carie cartelle per i vari uffici,
* per accedere a queste uso i children.*/
var nome=space.children[i].name;
if (nome == "1" || nome == "2" || nome == "3"){
logger.log(nome);
var rifContenutiCartella = space.children[i].children;
var contenutoCont = rifContenutiCartella.length;
logger.log("Contenuto sottocartella "+contenutoCont);
if (presenzaContenuto(rifContenutiCartella)){
/*Aggiungo un file txt che mi raccolga tutti i nomi dei doc presi per il WF, in questo doc partirà in WF */
var docCreato = space.children[i].createFile(nome+".txt");
var contents = new Array();
docCreato.content +="ELENCO DOCUMENTI INTERESSATI NEL WORKFLOW: "
for (i=0;i<rifContenutiCartella.length;i++){
contents[i] = rifContenutiCartella[i];
docCreato.content += "\r\n\r\ "+(i+1)+") "+rifContenutiCartella[i].name;
}
var docCreatoPDF = docCreato.transformDocument("application/pdf");
for (i=0;i<contents.length;i++){
logger.log(contents[i].name);
}
var workflow = actions.create("start-workflow");
workflow.parameters.workflowName = "jbpm$wfEntePAD:EntePubblico";
workflow.parameters["bpm:workflowDescription"] = "WORKFLOW";
for (i=0;i<contents.length;i++){
workflow.parameters["bpm:workflowPackage"] = contents[i];
}
workflow.execute(docCreatoPDF);
}
}
}The workflow start with only the document "docCreatoPDF", but I want to assignee it also the contents array document…the problem is at the end of file:
for (i=0;i<contents.length;i++){
workflow.parameters["bpm:workflowPackage"] = contents[i];
}It's possible?Help pleaseTHANKS