05-18-2010 01:26 AM
http://localhost:8080/alfresco/wcs/test/startWorkflow?nodeid=d8d0a561-093d-4492-a124-9fb63369fae2
Executing script /test/startWorkflow.get.js (in classpath store file:C:/Alfresco/tomcat/shared/classes/alfresco/extension/templates/webscripts)
nodeId = d8d0a561-093d-4492-a124-9fb63369fae2
theDocument = Node Type: {http://www.alfresco.org/model/content/1.0}content, Node Aspects: [{http://www.alfresco.org/model/content/1.0}auditable, {http://www.alfresco.org/model/system/1.0}referenceable, {http://www.alfresco.org/model/application/1.0}inlineeditable, {http://www.alfresco.org/model/content/1.0}titled, {http://www.alfresco.org/model/content/1.0}author]
theDocument nodeRef = workspace:/ /SpacesStore/d8d0a561-093d-4492-a124-9fb63369fae2
Attached JBPM Context to transaction 4d7d09fc-2917-407c-8373-157e14646314
Caught exception; decorating with appropriate status template : org.alfresco.scripts.ScriptException: 04170028 Failed to execute script '/test/startWorkflow.get.js (in classpath store file:C:/Alfresco/tomcat/shared/classes/alfresco/extension/templates/webscripts)': NodeRef must be supplied.
var nodeId = args.nodeid;
logger.log("nodeId = " + nodeId);
// var document = utils.getNodeFromString("workspace://SpacesStore/" + nodeId);
var theDocument = search.findNode("workspace://SpacesStore/" + nodeId);
logger.log("theDocument = " + theDocument);
logger.log("theDocument nodeRef = " + theDocument.nodeRef);
var workflowAction = actions.create("start-workflow");
workflowAction.parameters.workflowName = "jbpm$nmwf:MyWorkflow";
workflowAction.parameters["bpm:workflowDescription"] = "Please edit: " + theDocument.name;
workflowAction.parameters["bpm:assignees"] = [people.getPerson("admin"), people.getPerson("joebloe")];
var futureDate = new Date();
futureDate.setDate(futureDate.getDate() + 7);
workflowAction.parameters["bpm:workflowDueDate"] = futureDate;
workflowAction.parameters["bpm:dueDate"] = futureDate;
// workflowAction.execute(theDocument);
workflowAction.execute(theDocument.nodeRef);
workflowAction.signal();
05-18-2010 11:33 PM
var nodeId = args.nodeid;
var theDocument = search.findNode("workspace://SpacesStore/" + nodeId);
var workflowDefinition = workflow.getDefinitionByName("jbpm$nmwf:myWorkflow");
var workflowPackage = workflow.createPackage();
workflowPackage.addNode(theDocument);
var workflowParameters = [];
workflowParameters["bpm:workflowDescription"] = "Please edit: " + theDocument.name;
workflowParameters["bpm:assignees"] = [people.getPerson("admin"), people.getPerson("joebloe")];
var futureDate = new Date();
futureDate.setDate(futureDate.getDate() + 7);
workflowParameters["bpm:workflowDueDate"] = futureDate;
workflowParameters["bpm:dueDate"] = futureDate;
workflowParameters["bpm:workflowPriority"] = 1;
var workflowPath = workflowDefinition.startWorkflow(workflowPackage, workflowParameters);
// This does *not* work, I get "bpm_assignees is not defined"
// workflowPath.signal(null);
// End the start task
var tasks = workflowPath.getTasks();
for (task in tasks)
{
tasks[task].endTask(null);
}
09-21-2011 08:17 AM
09-21-2011 03:17 PM
Just a little up to know if someone has make progress on this problem ?
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.