Skip to main content

Step types

Every step in a workflow have a field stepType. The step type describes what is used for in the context of an asset (change properties, transfer facility, inventory movement, etc.). This field is already configured and the only thing that differs between the execution step of different type is the field stepExecutorMetadata.

Doing a call to the API endpoint /v1/step-executions/executable-workflows you can obtain the type of the step among other many things of your workflows.

The json below shows an example of one specific step in a workflow returned by this endpoint

{
"automatic": false,
"facility": {
"id": "demo-facility",
"name": "Demo facility",
"status": "OPERATIONAL"
},
"optional": false,
"ordinal": 1,
"stepDefinitionId": "start",
"stepName": "start",
"stepType": "INIT",
"updatableProperties": null
}

The different types of steps are described below

1. Init Step

To start a workflow, the step we have to run is an INIT step. This step is responsible to start the execution of a workflow and also creates the Asset. In the response of this call will get the Asset track id, that will be used in the consecutive calls to the next steps of this workflow.

In this step is not mandatory to provide the asset Track id, because is in the process of execution of this step where the asset is created. But if we want to "reuse" an asset importing an existing one to a workflow, the field assetTrackId must be filled with the asset Track id we want to import.

The step Executor field stepExecutorMetadata for this step will be an object containing the asset template of the workflow we want to execute

{
"assetTrackId":"",
"stepDefinitionId": "[your-step-definition-id]",
"stepExecutorMetadata": {"asset-template-id":"[your-asset-template-id]"},
"supplyChainId":"[your-supply-chain-id]",
"workflowDefinitionId":"[your-workflow-definition-id]"
}
tip

In order to know which are the asset template id of your workflow you can use the /v1/step-executions/executable-workflows endpoint. The authorization process and the execution of this endpoint is explained in detail in the Quickstart section in this documentation and included as well in the API Reference

2. Transfer Step

This step is used to change the facility of an asset. This is already preconfigured, and do not need to receive any input from the user. That's mean the stepExecutorMetadata must be filled with an empty object because is not needed any additional information.

example:

{
"assetTrackId":"[your-asset-track-id]",
"stepDefinitionId": "[your-step-definition-id]",
"stepExecutorMetadata": {},
"supplyChainId":"[your-supply-chain-id]",
"workflowDefinitionId":"[your-workflow-definition-id]"
}

This step, given that have not got any user input (usually) is configured as automatic.

3. Change properties Step

The change properties step is the step that changes the properties of an asset. In the stepExecutorMetadata for this kind of step we have to provide the identifiers and values of the properties we want to change.

{
"trackId":"[your-track-id]",
"step-definition-id":"[your-step-definition-id]",
"workflow-definition-id":"[your-workflow-definition-id]",
"supply-chain-id":"[your-supply-chain-id]",
"step-executor-metadata":{"properties":{"[your-property-id]":"[your-property-value]"}}
}

Every change property step is configured to accept one or more properties to change, those properties have to be included in an object as we see above. The properties object is a key/value object, the key is the identifier of the property and the value, is the value we want update this property.

In order to know which properties are configured in every step you can call the endpoint /v1/step-executions/executable-workflows endpoint. Is included in the documentation of the API Reference

caution

In case all the step properties were calculated or autogenerated this type of step can be configured as automatic, in that case it is not allowed to execute it.

4. Inventory Step

This step is used to change the quantities of an inventory product. It uses one of the properties of the Asset to get the quantity to add or subtract from a product balance.

As the case of transfer, this step can be configured to be automatic because is already preconfigured and there is no need of user input.

The stepExecutorMetadata must be an empty object

{
"trackId":"[your-track-id]",
"step-definition-id":"[your-step-definition-id]",
"workflow-definition-id":"[your-workflow-definition-id]",
"supply-chain-id":"[your-supply-chain-id]",
"step-executor-metadata":{}
}

5. Finish Step

All workflows must have a finish step, and is always the last step executed in a Workflow. When the finish step is in completed status, the workflow is considered finished. You can run an asset previously executed in a workflow into another workflow (import) but the previous workflows must be finished to perform the import in another workflow.

caution

This step is ALWAYS configured as automatic. We can not execute a step of type FINISH