Initiating Workfows

Ways workflows can be executed within the Kinetic Platform

There are a few different ways to trigger a workflow to run. The topics below are the most common, with 'From a Source' being the most common.

Directly from the Workflow Builder

Running a workflow directly from the definition is done in both the Task Workflow Builder and list of trees.

In the Workflow Builder, one of the options on the Action menu is to Run Tree.
runWorkflow1

Clicking on Run brings up the following dialog:
runworkflow2
From here it depends on the Source you are using and what the tree is expecting. For Request CE it is an extensive JSON string. For other applications it could be XML, or a simple lookup key. For Routines it is the defined inputs (from none -- as above -- to many).

To Run a workflow from the list of trees in Task, the list of tasks in a run, or the definition of the workflow, select Run from the drop-down options on the far right of the tree listing.
runworkflow5 runworkflow3 runworkflow4
These bring up the same dialog as selecting Run from the Workflow Builder.

From Previous Run

Workflow Runs provide you an opportunity to perform the run again option directly from the run itself. Similar to the builder and the tree list, there is an Action button, and the option to "Run Again'. The only difference in the dialog is that the Source Data field is prefilled with the previous input information.
runworkflow5
This is a great opportunity to alter existing inputs and see what happens with changes.

Via API

If you need to run a workflow outside of the Task application, and not from a source application, you can use the API. Running a workflow is a POST action with the following structure:
/run-tree/{source}/{group}/{tree}

Here is a more complete example using Kinetic Request as the source:

http://myServer:myPort/app/api/v1/run-tree/Kinetic%20Request/Submissions%20%3E%20${kapp('slug')}%20%3E%20${form('slug')}/Submitted

For a form in the Services kapp with a slug of cleaning the structure would look like this:

`http://myServer:myPort/kinetic-task/app/api/v1/run-tree/Kinetic Request/Submissions > services > cleaning/Submitted`

The other piece required for this method is constructing and posting the input required for the source.