06-22-2009 11:44 AM
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);
}
}
}
for (i=0;i<contents.length;i++){
workflow.parameters["bpm:workflowPackage"] = contents[i];
}
06-22-2009 04:57 PM
for (i=0;i<contents.length;i++){
bpm_package.addNode(contents[i]);
};
06-23-2009 03:48 AM
It's rather easy to do in javascript from within the workflow. As the bpm_package is recognized as a scriptNode, we can write to it the same way we can write to any other sort of node. Your code would look something like this:
for (i=0;i<contents.length;i++){
bpm_package.addNode(contents[i]);
};
06-23-2009 03:59 AM
06-23-2009 04:04 AM
06-23-2009 04:24 AM
06-23-2009 04:34 AM
Your line of code:
workflow.parameters["bpm:workflowPackage"] = contents;
Does not look correct if you want to pass in a collection of documents to a workflow.
06-23-2009 02:53 PM
06-24-2009 03:21 AM
Oh, I get what you're trying to do.
Do you have the Alfresco-SDK checked out? There is a java class test file called "JBPMEngineTest.java" under the Repository project. Look through that, it'll give you a better idea on how to do this. Though, I'm still not sure on porting it to javascript.
09-02-2009 06:32 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.