As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
<webscript> <shortname>Create Workflow Instance</shortname> <description> Creates a workflow instance and returns a instance identification of the new workflow. </description> <url>/workflow-instance-create?definition={definition}&description={description}&assign={assign}&=fileNodeId{fileNodeId?} </url> <args> <arg> <shortname>definition</shortname> <description>the work flow definition name</description> </arg> <arg> <shortname>description</shortname> <description>the description for the new workflow</description> </arg> <arg> <shortname>assign</shortname> <description>the person uid to assign the first task</description> </arg> <arg> <shortname>fileNodeId</shortname> <description>the file node id that we want to attach to the workflow</description> </arg> </args> <format default="json">extension</format> <authentication>user</authentication> </webscript>
//Arguments values var definition = args.definition; var description = args.description; var assignee = args.assign; var FileNodeId = args.fileNodeId var registrationWorkflowDefinition = workflow.getDefinitionByName(definition); //Parameters var parameters = new Object(); parameters["bpm:workflowDescription"] = description; parameters["bpm:assignee"] =[people.getPerson(assignee)]; //Attached File if (FileNodeId!= null) { var nodeId = FileNodeId; var theDocument = search.findNode("workspace://SpacesStore/" + nodeId); var workflowPackage = workflow.createPackage(); workflowPackage.addNode(theDocument); } else { var workflowPackage = workflow.createPackage(); } //Creating the workflow //Note the order of the arguments in startWorkflow method are in inverse order than documentation var registrationWorkflowStart = registrationWorkflowDefinition.startWorkflow(workflowPackage,parameters); //Values to return model.workflowInstance = registrationWorkflowStart.instance; model.workflowInstanceID = registrationWorkflowStart.id;
{ "id": "${workflowInstance.id}" }