Skip to content

Managing Workflows

Managing workflows are probably best done by using the TACTIC Workflow Editor. It is possible to create workflows through the API, although large workflows could be unwieldy to manager. The solutions presented here could be useful if trying to import a workflow that was created in another application and needs to be recreated in TACTIC.

Workflow Definiton

The workflow definition is stored in XML. The following show the XML document for a simple linear workflow with 3 nodes( "first", "second", "third" ), each node connected to each other.

<pipeline>
  <process name="first"/>
  <process name="second"/>
  <process name="third"/>
  <connect from="first" to="second"/>
  <connect from="second" to="third"/>
</pipeline>

Note

Internally, TACTIC uses the word "pipelines" instead of "workflows". From TACTIC's point of view, these are functionality identical and can be used interchangably.

Positioning the nodes

The xml above will functionally work, however, visually, TACTIC will layout them out in a simple horizontal line. However, if the workflow is more complex and there is a lot of branching, TACTIC will need more information to draw it correctly in the "Workflow Manager"

<pipeline>
  <process name="first" xpos="100" ypos="100"/>
  <process name="second" xpos="200" ypos="200"/>
  <process name="third" xpos="300" ypos="300"/>
  <connect from="first" to="second"/>
  <connect from="second" to="third"/>
</pipeline>

Settings xpos and ypos attributes of each of the process nodes to these values will posistion the nodes in a diagonal line. For clairity, of course, it is always better to position nodes either using the TACTIC Workflow Manager or by extracting the positions from some 3rd party tool.

Adding a new Workflow

The workflow sType used for search, inserting and updating items is "sthpw/pipeline".

The minimum attributes to insert a workflow are the following:

  1. name: The display name of the workflow
  2. project_code: The project that this workflow belongs to
  3. search_type: the parent sType that this workflow will be assigned

The following sample code will create a workflow in the specified project:

let workflow = '<pipeline ..../>';

let project_code = "My Project";

let data = {
    name: "My First Workflow",
    workflow: workflow,
    project_code: project_code,
    search_type: "workflow/job"
}

workflow = call_tactic("insert", {
    search_type: "sthpw/pipeline",
    data: data
} )

Process sObjects

There are also process sObjects related to the workflow which are used to store all the data for each individual process. The "pipeline" sObject is mainly concerned with how all the process nodes connect together, while each indivisual process sObject stores the behavior of each node.

A built-in trigger that will create all of the process sObjects upon insert of a workflow, so with the above code a set of 3 process sobjects will be created.

You can query for these using the sType "config/process".

let search_type = "config/process";

let filters = [
    ["pipeline_code", workflow.code]
]

let processes = call_tactic("query", {
        search_type: "config/process",
        filters: filters,
    );